Esempio n. 1
0
    void onPlay()
    {
        if (tileSystem == null)
        {
            gameState = GameState.Init;
        }
        TileIndex tiRight = tileSystem.ClosestTileIndexFromWorld(charactorRight.transform.position);

        if (tiRight.row == 1 && tiRight.column == 7)
        {
            TileIndex tiLeft = tileSystem.ClosestTileIndexFromWorld(charactorLeft.transform.position);
            if (tiLeft.row == 1 && tiLeft.column == 9)
            {
                gameState = GameState.Win;
            }
        }
        else if (tiRight.row == 1 && tiRight.column == 9)
        {
            TileIndex tiLeft = tileSystem.ClosestTileIndexFromWorld(charactorLeft.transform.position);
            if (tiLeft.row == 1 && tiLeft.column == 7)
            {
                gameState = GameState.Win;
            }
        }
    }
Esempio n. 2
0
    public bool CheckTile(string arrow)
    {
        PlayerTileIndex = _TileSystem
                          .ClosestTileIndexFromWorld(PlayerTransform.position);
        int x = PlayerTileIndex.row;
        int y = PlayerTileIndex.column;

        switch (arrow)
        {
        case "up":      x -= 1; break;

        case "down":    x += 1; break;

        case "left":    y -= 1; break;

        case "right":   y += 1; break;
        }
        if (x < 0 || y < 0 || x > 10 || y > 10)
        {
            return(false);
        }
        OtherTileData = _TileSystem.GetTile(x, y);
        if (OtherTileData != null)
        {
            if (OtherTileData.GetUserFlag(1))
            {
                _AM.talk(x, y, OtherTileData);
                return(false);
            }
            if (OtherTileData.GetUserFlag(2))
            {
                _AM.daoju(x, y, OtherTileData);
                return(true);
            }
            if (OtherTileData.GetUserFlag(3))
            {
                _AM.guaiwu(x, y, OtherTileData);
                return(false);
            }
            if (OtherTileData.GetUserFlag(4))
            {
                _AM.door(x, y, OtherTileData);
                return(false);
            }
            if (OtherTileData.GetUserFlag(5))
            {
                _AM.key(x, y, OtherTileData);
                return(true);
            }
            if (OtherTileData.GetUserFlag(6))
            {
                _AM.stair(x, y, OtherTileData);
                return(false);
            }
            if (OtherTileData.GetUserFlag(7))
            {
                _AM.tujian(x, y, OtherTileData);
                return(true);
            }
            if (OtherTileData.GetUserFlag(8))
            {
                _AM.feixing(x, y, OtherTileData);
                return(true);
            }
            if (OtherTileData.GetUserFlag(9))
            {
                _AM.guaiwu(x, y, OtherTileData);
                return(false);
            }
            if (OtherTileData.SolidFlag)
            {
                return(false);
            }
        }
        return(true);
    }
Esempio n. 3
0
        public bool checkTile(string arrow)
        {
            playerTileIndex = tileSystem.ClosestTileIndexFromWorld(playerTransform.position);
            int x = playerTileIndex.row;
            int y = playerTileIndex.column;

            switch (arrow)
            {
            case "up":
                x -= 1;
                break;

            case "down":
                x += 1;
                break;

            case "left":
                y -= 1;
                break;

            case "right":
                y += 1;
                break;

            default:
                break;
            }
            if (x < 0 || y < 0 || x > 10 || y > 10)
            {
                return(false);
            }
            otherTileData = tileSystem.GetTile(x, y);
            if (otherTileData != null)
            {
                if (otherTileData.GetUserFlag(1))
                {
                    //AM.talk(x, y, otherTileData);
                    otherTileData.gameObject.GetComponent <Talk>().Execute(x, y, otherTileData);
                    return(false);
                }
                if (otherTileData.GetUserFlag(2))
                {
                    otherTileData.gameObject.GetComponent <Daoju>().Execute(x, y, otherTileData);
                    //AM.daoju(x, y, otherTileData);
                    return(true);
                }
                if (otherTileData.GetUserFlag(3))
                {
                    otherTileData.gameObject.GetComponent <Guaiwu>().Execute(x, y, otherTileData);
                    //AM.guaiwu();
                    return(false);
                }
                if (otherTileData.GetUserFlag(4))
                {
                    //AM.door(x, y, otherTileData);
                    otherTileData.gameObject.GetComponent <TRAnimation>().Execute(x, y, otherTileData);
                    return(false);
                }
                if (otherTileData.GetUserFlag(5))
                {
                    otherTileData.gameObject.GetComponent <Key>().Execute(x, y, otherTileData);
                    //AM.key(x, y, otherTileData);
                    return(true);
                }
                if (otherTileData.GetUserFlag(6))
                {
                    //AM.stair(x, y, otherTileData);
                    otherTileData.gameObject.GetComponent <Stair>().Execute(x, y, otherTileData);
                    return(false);
                }
                if (otherTileData.GetUserFlag(7))
                {
                    otherCommand.tujian(x, y, otherTileData);
                    return(true);
                }
                if (otherTileData.GetUserFlag(8))
                {
                    otherCommand.feixing(x, y, otherTileData);
                    return(true);
                }
                if (otherTileData.GetUserFlag(9))
                {
                    otherCommand.boss(x, y, otherTileData);
                    return(true);
                }
                if (otherTileData.SolidFlag)
                {
                    return(false);
                }
                return(true);
            }
            else
            {
                return(true);
            }
        }