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); }
public static bool SeeForCollisionWithTreasure(ThorinTeam team, Treasure treasure) { if (team.CanCollideWith(treasure)) { return(true); } else { return(false); } }
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)); }
public static Item SeeForCollisionWithItems(ThorinTeam team, List <Item> allItems) { foreach (var item in allItems) { if (team.CanCollideWith(item)) { return(item); } } return(null); }
public static Friend SeeForCollisionsWithFriends(ThorinTeam team, ICollection <Friend> allFriends) { foreach (var friend in allFriends) { if (team.CanCollideWith(friend)) { return(friend); } } return(null); }
public static bool SeeForCollisionsWithWalls(ThorinTeam team, ICollection <Wall> allWalls) { foreach (var wall in allWalls) { if (team.CanCollideWith(wall)) { return(true); } } return(false); }