Beispiel #1
0
    void CalculateDirection()
    {
        byte[] constDir = new byte[4] {
            _DIR_EAST, _DIR_WEST, _DIR_SOUTH, _DIR_NORTH
        };
        Vector2[] dirPos = new Vector2[4] {
            new Vector2(_x + 1, _y), new Vector2(_x - 1, _y), new Vector2(_x, _y - 1), new Vector2(_x, _y + 1)
        };
        byte dir = 0;

        for (int i = 0; i < dirPos.Length; ++i)
        {
            if (CheckWall(ref dir, constDir[i], dirPos[i]) == 0)
            {
                UIManager._Instance.SetTipInfo(Tip.GetShowTips(dir, true));
                if (GameData._IsShowedOpenDoorTutorial &&
                    GameData._IsOpenTutorial)
                {
                    GameData._IsShowedOpenDoorTutorial = false;
                    UIManager._Instance.SetSysMsgInfo(SystemMessage._tutorialString_OpenDoor);
                }
                return;
            }
        }
        UIManager._Instance.SetTipInfo(Tip.GetShowTips(dir));

        dir = 0;
        for (int i = 0; i < dirPos.Length; ++i)
        {
            CheckPit(ref dir, constDir[i], dirPos[i]);
        }
        string pitString = Tip.GetPitTips(dir);

        if (!(string.IsNullOrEmpty(pitString)))
        {
            UIManager._Instance.SetTipInfo(pitString);
        }

        dir = 0;
        for (int i = 0; i < dirPos.Length; ++i)
        {
            CheckEnemy(ref dir, constDir[i], dirPos[i]);
        }
        string enemyString = Tip.GetEnemyTips(dir);

        if (!(string.IsNullOrEmpty(enemyString)))
        {
            UIManager._Instance.SetTipInfo(enemyString);
        }
    }
Beispiel #2
0
    void CalculateDirection(bool isMoved = true)
    {
        Vector2[] dirPos = new Vector2[4]
        {
            new Vector2(_x + 1, _y), new Vector2(_x - 1, _y),
            new Vector2(_x, _y - 1), new Vector2(_x, _y + 1)
        };
        byte dir = 0;

        for (int i = 0; i < dirPos.Length; ++i)
        {
            // touch the door
            if (MapManager.Check(ref dir, MapManager._constDirs[i], dirPos[i], MapCode.WALL) == 0)
            {
                UIManager._Instance.SetTipInfo((isMoved ? "" : Tip._cannotMove) + Tip.GetShowTips(dir, true));
                if (GameData._IsShowedOpenDoorTutorial &&
                    GameData._IsOpenTutorial)
                {
                    GameData._IsShowedOpenDoorTutorial = false;
                    UIManager._Instance.SetSysMsgInfo(SystemMessage._tutorialString_OpenDoor);
                }
                return;
            }
        }
        UIManager._Instance.SetTipInfo((isMoved ? "" : Tip._cannotMove) + Tip.GetShowTips(dir));

        dir = 0;
        for (int i = 0; i < dirPos.Length; ++i)
        {
            MapManager.Check(ref dir, MapManager._constDirs[i], dirPos[i], MapCode.PIT);
        }
        string pitString = Tip.GetPitTips(dir);

        if (!(string.IsNullOrEmpty(pitString)))
        {
            UIManager._Instance.SetTipInfo(pitString);
        }

        dir = 0;
        for (int i = 0; i < dirPos.Length; ++i)
        {
            MapManager.Check(ref dir, MapManager._constDirs[i], dirPos[i], MapCode.ENEMY);
        }
        string enemyString = Tip.GetEnemyTips(dir);

        if (!(string.IsNullOrEmpty(enemyString)))
        {
            UIManager._Instance.SetTipInfo(enemyString);
        }
    }