This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class CubePlacer : MonoBehaviour | |
{ | |
private Grid grid; | |
private void Awake() | |
{ | |
grid = FindObjectOfType<Grid>(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class Grid : MonoBehaviour | |
{ | |
[SerializeField] | |
private float size = 1f; | |
public Vector3 GetNearestPointOnGrid(Vector3 position) | |
{ | |
position -= transform.position; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class PooledMonoBehaviour : MonoBehaviour | |
{ | |
[SerializeField] | |
private int initialPoolSize = 100; | |
public int InitialPoolSize {get {return initialPoolSize; } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Pool : MonoBehaviour | |
{ | |
private static Dictionary<PooledMonoBehaviour, Pool> pools = new Dictionary<PooledMonoBehaviour, Pool>(); | |
private Queue<PooledMonoBehaviour> objects = new Queue<PooledMonoBehaviour>(); | |
private List<PooledMonoBehaviour> disabledObjects = new List<PooledMonoBehaviour>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class Launcher : MonoBehaviour | |
{ | |
[SerializeField] | |
private Transform[] firePoints; | |
[SerializeField] | |
private Rigidbody projectilePrefab; | |
[SerializeField] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using TMPro; | |
using UnityEngine; | |
public class CheckpointText : MonoBehaviour | |
{ | |
private TextMeshProUGUI tmText; | |
private Animator animator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Serializable] | |
public struct RangedFloat | |
{ | |
public float minValue; | |
public float maxValue; | |
public RangedFloat(float minValue, float maxValue) | |
{ | |
this.minValue = minValue; | |
this.maxValue = maxValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public class SnapToGround : MonoBehaviour | |
{ | |
[MenuItem("Custom/Snap To Ground %g")] | |
public static void Ground() | |
{ | |
foreach(var transform in Selection.transforms) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class PooledMonoBehaviour : MonoBehaviour | |
{ | |
[SerializeField] | |
private int initialPoolSize = 100; | |
public int InitialPoolSize { get { return initialPoolSize; } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
public class Pool : MonoBehaviour | |
{ | |
private static Dictionary<PooledMonoBehaviour, Pool> pools = new Dictionary<PooledMonoBehaviour, Pool>(); | |
private Queue<PooledMonoBehaviour> objects = new Queue<PooledMonoBehaviour>(); | |
private List<PooledMonoBehaviour> disabledObjects = new List<PooledMonoBehaviour>(); |