public static GolfHoleController GetInstance() { if (instance == null) { instance = new GolfHoleController(); } return(instance); }
private void Update() { if (GameController.GetInstance().GetState() == GameController.StateType.WAITINGBALL) { bool behindGolfHole = (GolfHoleController.GetInstance().GetPositionX() + 0.5f < transform.position.x); bool inFrontOfGolfHole = (launched && rb.velocity == new Vector2(0.0f, 0.0f)); // Ball fails to hit if ((inFrontOfGolfHole || behindGolfHole) && !hit) { GameController.GetInstance().SetState(GameController.StateType.GAMEOVER); } } }
private void Awake() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } if (!spawnPointTransform) { spawnPointTransform = transform; } defaultSpawnPosition = spawnPointTransform.position; }