{"id":13661809,"url":"https://github.com/PlayCreatively/FreyrEssentials","last_synced_at":"2025-04-25T03:31:26.170Z","repository":{"id":167834445,"uuid":"300470552","full_name":"PlayCreatively/FreyrEssentials","owner":"PlayCreatively","description":"Tools I wouldn't function without 💻","archived":false,"fork":false,"pushed_at":"2021-12-23T12:27:22.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-10T16:46:25.437Z","etag":null,"topics":["csharp","essentials","timer","unity","utility"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlayCreatively.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-02T01:34:05.000Z","updated_at":"2022-05-10T19:05:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"4820431f-f3de-48b5-86bf-10a775897f0e","html_url":"https://github.com/PlayCreatively/FreyrEssentials","commit_stats":null,"previous_names":["playcreatively/freyressentials"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlayCreatively%2FFreyrEssentials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlayCreatively%2FFreyrEssentials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlayCreatively%2FFreyrEssentials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlayCreatively%2FFreyrEssentials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlayCreatively","download_url":"https://codeload.github.com/PlayCreatively/FreyrEssentials/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250747810,"owners_count":21480722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","essentials","timer","unity","utility"],"created_at":"2024-08-02T05:01:41.985Z","updated_at":"2025-04-25T03:31:26.161Z","avatar_url":"https://github.com/PlayCreatively.png","language":"C#","readme":"# ⏳ Timer class\nCreate a countdown and start the timer\n``` c#\n//Create and start a count down of 5 seconds.\nTimer myTimer = Timer.Create(5f);\n```\nread the value as a normal progression of the countdown ranging from 0 to 1\n``` c#\n//Interpolate between pointA and pointB by myTimer's progression to 5 seconds.\nVector2.Lerp(pointA, pointB, myTimer)\n```\nor as a bool\n``` c#\n//While myTimer hasn't reached 5 seconds.\nwhile(!myTimer)\n```\n\n\n# Pool\\\u003cT\u003e class  \n_Lightweight generic pooling class._\n\n### 🤔 Why use Pool?\nPool is just a simple lightweight pooling system which takes care of the pooling boilerplate.\n\n### How to use \u003cimg src=\"https://static.wikia.nocookie.net/dragonquest/images/6/60/Slime_Artwork.png/revision/latest/scale-to-width-down/1000?cb=20201021141416\" draggable=\"false\" alt=\"drawing\" width=\"30\"/\u003e\u003cimg/\u003e\n\n### 🔨 Constructing a pool\n``` c#\nPool\u003cSlime\u003e slimePool = new Pool\u003cSlime\u003e(\n            CreateNew: () =\u003e new GameObject().AddComponent\u003cSlime\u003e(),\n            OnChange: (isSpawning, slime) =\u003e slime.gameObject.SetActive(isSpawning));\n```\n___\nThe first parameter called `CreateNew` is a `Func\u003cT\u003e` which will be used\nby the Pool class to create new instances of `T`.\n``` c#\n//Method which instantiates a gameObject, adds a slime component and returns a reference to it.\nCreateNew: () =\u003e new GameObject().AddComponent\u003cSlime\u003e() \n```\n___\nThe second parameter is optional, called `OnChange` which is an `Action\u003cbool, T\u003e` and runs when a T instance is being either __borrowed__ or __returned__.\n``` c#\n//Enable or disable the slime component based on if it's being borrowed or returned.\nOnChange: (isSpawning, slime) =\u003e slime.gameObject.SetActive(isSpawning)\n```\n### 🔁 Borrow/Return\nNow that you've made a pool you can start borrowing and returning slime instances using `slimePool.Borrow()` and `slimePool.Return(Slime)` respectively.\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPlayCreatively%2FFreyrEssentials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPlayCreatively%2FFreyrEssentials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPlayCreatively%2FFreyrEssentials/lists"}