예제 #1
0
    // To be called on ticks where the balls are in the middle of a tile
    void ExecuteTickMainTurn()
    {
        foreach (BallBehaviour ball in board.activeBalls)
        {
            TileBehaviour tile = board.GetTileInside(ball);
            if (!tile)
            {
                Debug.LogError("Ball outside board");
                gameState.isPaused = true;
                continue;
            }

            switch (tile.tileType)
            {
            case TileBehaviour.TileType.Vault:
                ball.forward *= -1.0f;
                break;

            default:
                BounceBall(ball);
                break;
            }

            tile.ConditionalBlock(ball.forward);

            if (tile.pickup)
            {
                tile.pickup.PickUp(ball);
            }
        }
    }
예제 #2
0
    // To be called on ticks where the balls are on the edge between two tiles
    void ExecuteTickOffTurn()
    {
        foreach (BallBehaviour ball in board.activeBalls)
        {
            TileBehaviour tile = board.GetTileEntered(ball);
            if (!tile)
            {
                Debug.LogError("Ball leaving board");
                gameState.isPaused = true;
                continue;
            }

            if (tile.tileType == TileBehaviour.TileType.Block)
            {
                ball.forward *= -1.0f;
            }
            else if (tile.tileType == TileBehaviour.TileType.Vault)
            {
                if (!tile.GetComponentInChildren <VaultBehaviour>().CanEnter(ball.forward))
                {
                    ball.forward *= -1.0f;
                }
            }
            else if (tile.tileType == TileBehaviour.TileType.LockRed || tile.tileType == TileBehaviour.TileType.LockBlue)
            {
                if (tile.GetComponentInChildren <RaiseBehaviour>().isRaised)
                {
                    ball.forward *= -1.0f;
                }
            }
            else
            {
                BounceBall(ball);
            }

            tile.ConditionalBlock(ball.forward * -1.0f);
        }
    }