Skip to content

Instantly share code, notes, and snippets.

View lucasctnh's full-sized avatar
✌️

lucas coutinho lucasctnh

✌️
View GitHub Profile
@lucasctnh
lucasctnh / gist:924a314ef61e8adbc2ec091ebabf31b6
Last active September 2, 2023 22:52
Code Snippet - Condition Model
public class Condition {
[Serializable]
public struct ConditionByAmount {
[Tooltip("Wheter the condition is by amount or not")]
public bool isConditionByAmount;
[Tooltip("Check for amount of coins, uncheck for amount of score")]
public bool isAmountCoin;
[Tooltip("The targeted amount")]
public int targetAmount;
}
@lucasctnh
lucasctnh / gist:df30b4956496117237b95c2d67f982e2
Last active September 2, 2023 22:50
Code Snippet - Spawn Manager Core
private void SpawnHitable() {
while (_isSelectingPool) {
ObjectPool<Hitable> pool = GetRandomPool();
Hitable hitable = pool.Get();
hitable.GetComponent<Hitable>().SetKill(hitable => Kill(pool, hitable));
// ...
if (!CheckShouldSpawn(hitable))
pool.Release(hitable);
}
_isSelectingPool = true;
@lucasctnh
lucasctnh / gist:26282e31ed45079017cdfa27c8a6835a
Last active September 2, 2023 22:49
Code Snippet - Spawn Manager Core (Update)
private void Update() {
if (GameManager.Instance.isGameRunning)
GameManager.CallRepeating(SpawnHitable, ref _timer, repeatRate);
}
@lucasctnh
lucasctnh / gist:a4827c59c100a2ee1c9771f75241a752
Last active September 2, 2023 22:44
Code Snippet - Infinite Move Left
public class MoveLeftAndRepeat : MonoBehaviour {
[Range(0f, 1f)]
[SerializeField] private float _customSpeed = 1f;
private Vector3 _startPos;
private float _repeatWidth;
private void Start() {
_startPos = transform.position;
_repeatWidth = GetComponent<BoxCollider>().size.x / 2 - GetComponent<BoxCollider>().center.x;
}
@lucasctnh
lucasctnh / .editorconfig
Created January 10, 2022 01:33
VSCode .editorconfig for Unity programming
[*.{cs,vb}]
dotnet_diagnostic.IDE0044.severity = none
dotnet_diagnostic.IDE0047.severity = none
# IDE0051 Private member is unused.
dotnet_diagnostic.IDE0051.severity = none
dotnet_diagnostic.IDE0090.severity = none
@lucasctnh
lucasctnh / .gitignore
Last active February 11, 2024 20:25
Unity's .gitignore
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
@lucasctnh
lucasctnh / .gitattributes
Created January 10, 2022 01:28
Unity's .gitattributes
#
# Git attributes for Unity projects
#
# Compiled by the GameCI community - https://game.ci
#
# Latest version at https://gist.github.com/webbertakken/ff250a0d5e59a8aae961c2e509c07fbc
#
# Ensure that text files that any contributor introduces to the repository have their line endings normalized
* text=auto