Ejemplo n.º 1
0
    public GameBattleUnit getUnit(int x, int y, GameBattleUnit u = null)
    {
        for (int i = 0; i < user.Count; i++)
        {
            GameBattleUnit unit = user[i];

            if (unit == u)
            {
                continue;
            }

            if (!unit.IsAlive)
            {
                continue;
            }

            if (unit.checkPosition(x, y))
            {
                return(unit);
            }
        }

        for (int i = 0; i < enemy.Count; i++)
        {
            GameBattleUnit unit = enemy[i];

            if (unit == u)
            {
                continue;
            }

            if (!unit.IsAlive)
            {
                continue;
            }

            if (unit.checkPosition(x, y))
            {
                return(unit);
            }
        }

        for (int i = 0; i < npc.Count; i++)
        {
            GameBattleUnit unit = npc[i];

            if (unit == u)
            {
                continue;
            }

            if (!unit.IsAlive)
            {
                continue;
            }

            if (unit.checkPosition(x, y))
            {
                return(unit);
            }
        }

        return(null);
    }