change: Switched the state controller and scene controller to a singleton class
This doesnt' change any of the logic, but simplifies a lot of the main game loop code. Many things still rely on the singleton class, but shouldn't so this will be fixed in a later commit
This commit is contained in:
@@ -8,7 +8,8 @@ public class VictoryObjectBehavior : MonoBehaviour
|
||||
public float speed = 1f;
|
||||
Vector2 initPosition;
|
||||
|
||||
void Awake() {
|
||||
void Awake()
|
||||
{
|
||||
initPosition = this.transform.position;
|
||||
}
|
||||
|
||||
@@ -18,13 +19,16 @@ public class VictoryObjectBehavior : MonoBehaviour
|
||||
transform.position = new Vector2(initPosition.x, initPosition.y + Mathf.Sin(Time.time * speed) * height);
|
||||
}
|
||||
|
||||
void OnDrawGizmos() {
|
||||
void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.DrawLine(new Vector3(transform.position.x, transform.position.y - height, transform.position.z), new Vector3(transform.position.x, transform.position.y + height, transform.position.z));
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D col) {
|
||||
if (col.tag == "Player") {
|
||||
GameObject.FindGameObjectWithTag("StateController").GetComponent<StateController>().ShowVictoryCanvas();
|
||||
void OnTriggerEnter2D(Collider2D col)
|
||||
{
|
||||
if (col.tag == "Player")
|
||||
{
|
||||
StateController.Instance.ShowVictoryCanvas();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user