Example #1
0
 public void AddObject(GameObject obj)
 {
     if (obj is ThorinTeam)
     {
         team = obj as ThorinTeam;
     }
     else if (obj is IEnemy)
     {
         this.allEnemies.Add(obj as Enemy);
     }
     else if (obj is Wall)
     {
         this.allWalls.Add(obj as Wall);
     }
     else if (obj is Friend)
     {
         this.allFriends.Add(obj as Friend);
     }
     else if (obj is Item)
     {
         this.allItems.Add(obj as Item);
     }
     else if (obj is Treasure)
     {
         this.treasure = obj as Treasure;
     }
     this.allObjects.Add(obj);
 }
Example #2
0
 public static bool SeeForCollisionWithTreasure(ThorinTeam team, Treasure treasure)
 {
     if (team.CanCollideWith(treasure))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #3
0
        public static BattleHandler SeeForCollisionsWithEnemies(ThorinTeam team, List <Enemy> allObjects)
        {
            foreach (var otherObj in allObjects)
            {
                if (team.CanCollideWith(otherObj))
                {
                    return(new BattleHandler(team, otherObj as Enemy));
                }
            }

            return(new BattleHandler(null, null));
        }
Example #4
0
        public static Item SeeForCollisionWithItems(ThorinTeam team, List <Item> allItems)
        {
            foreach (var item in allItems)
            {
                if (team.CanCollideWith(item))
                {
                    return(item);
                }
            }

            return(null);
        }
Example #5
0
        public static Friend SeeForCollisionsWithFriends(ThorinTeam team, ICollection <Friend> allFriends)
        {
            foreach (var friend in allFriends)
            {
                if (team.CanCollideWith(friend))
                {
                    return(friend);
                }
            }

            return(null);
        }
Example #6
0
        public static bool SeeForCollisionsWithWalls(ThorinTeam team, ICollection <Wall> allWalls)
        {
            foreach (var wall in allWalls)
            {
                if (team.CanCollideWith(wall))
                {
                    return(true);
                }
            }

            return(false);
        }