Example #1
0
    public override IEnumerator Enter()
    {
        if (OnPlayerTurn != null)
        {
            OnPlayerTurn();
        }

        if (touchHandler == null)
        {
            touchHandler = new TouchHandler();
        }
        MatchManager.startTimer = true;
        MatchManager.SetCamera();
        if (MatchManager.AreAllBallsInHole())
        {
            MatchManager.Instance.NextHole();
            return(base.Enter());
        }
        if (MatchManager.GetCurrentPlayer().AreAllBallsInHole())
        {
            MatchManager.ChangePlayer();
            MatchManager.SetState(new PlayerTurn(MatchManager));
        }

        return(base.Enter());
    }
Example #2
0
    public override void Tick()
    {
        if (!MatchManager.AreBallsMoving())
        {
            MatchManager.SaveBallPositions();
            MatchManager.ChangePlayer();
            MatchManager.SetState(new PlayerTurn(MatchManager));
        }

        if (MatchManager.matchTimer <= 0)
        {
            MatchManager.startTimer = false;
        }
        base.Tick();
    }