Esempio n. 1
0
        /// <summary>Returns true if the tile is occupied by another the the requested player.</summary>
        public PlayerType GetOccupied(Tile tile, PlayerType player)
        {
            switch (player)
            {
            case PlayerType.Hero1:
                if (hero2.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero2);
                }
                if (hero3.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero3);
                }
                if (hero4.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero4);
                }
                break;

            case PlayerType.Hero2:
                if (hero1.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero1);
                }
                if (hero3.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero3);
                }
                if (hero4.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero4);
                }
                break;

            case PlayerType.Hero3:
                if (hero1.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero1);
                }
                if (hero2.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero2);
                }
                if (hero4.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero4);
                }
                break;

            case PlayerType.Hero4:
                if (hero1.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero1);
                }
                if (hero2.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero2);
                }
                if (hero3.IsCurrentLocation(tile))
                {
                    return(PlayerType.Hero3);
                }
                break;
            }
            return(PlayerType.None);
        }