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
public class Projectile : 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
var projectile = prefab.Get<Projectile>(); |
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 StatesBySwitch : MonoBehaviour | |
{ | |
private StateIds currentStateId; | |
private void Update() | |
{ | |
switch (currentStateId) | |
{ |
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 Character : MonoBehaviour | |
{ | |
private State currentState; | |
private void Start() | |
{ | |
SetState(new ReturnHomeState(this)); | |
} |
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
public abstract class State | |
{ | |
protected Character character; | |
public abstract void Tick(); | |
public virtual void OnStateEnter() { } | |
public virtual void OnStateExit() { } | |
public State(Character character) |
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 ReturnHomeState : State | |
{ | |
private Vector3 destination; | |
public ReturnHomeState(Character character) : base(character) | |
{ | |
} |
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 WanderState : State | |
{ | |
private Vector3 nextDestination; | |
private float wanderTime = 5f; | |
private float timer; |
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 Character : MonoBehaviour | |
{ | |
[SerializeField] | |
private float moveSpeed = 1f; | |
private State currentState; | |
private void Start() |
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
private void OnDrawGizmos() | |
{ | |
#if UNITY_EDITOR | |
var wave = GetComponentInParent<Wave>(); | |
var name = string.Format("{0}\r\n{1}", wave != null ? wave.name : "NOWAVE", gameObject.name); | |
bool isSelectedWave = transform.IsInCurrentSelectedWave(); | |
Gizmos.color = isSelectedWave ? Color.green : Color.gray; |
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
public override string ToString() | |
{ | |
float initialSpawnTime = _initialDelayTimer; | |
var waveTimedTrigger = GetComponentInParent<WaveTimedTrigger>(); | |
if (waveTimedTrigger != null) | |
initialSpawnTime += waveTimedTrigger.Delay; | |
var formattedDelay = TimeSpan.FromSeconds(initialSpawnTime + _initialDelayBeforeSpawns); | |
var name = string.Format("Spawn {0} [{1}/{2}]", _numberOfEnemiesToSpawn, _numberToSpawnAtOnce, _delayBetweenSpawns, initialSpawnTime); |