Exemplo n.º 1
0
 public static GolfHoleController GetInstance()
 {
     if (instance == null)
     {
         instance = new GolfHoleController();
     }
     return(instance);
 }
Exemplo n.º 2
0
    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);
            }
        }
    }
Exemplo n.º 3
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance == this)
        {
            Destroy(gameObject);
        }

        if (!spawnPointTransform)
        {
            spawnPointTransform = transform;
        }
        defaultSpawnPosition = spawnPointTransform.position;
    }