/// <summary> /// Inserts a StaticEntity to the Map and the appropriate List, if possible. /// </summary> /// <param name="e">The StaticEntity to insert</param> /// <param name="x">The X-coordinate of the intended origin Cell</param> /// <param name="y">The Y-coordinate of the intended origin Cell</param> /// <returns>True if insertion was successful, false otherwise</returns> public bool insert(StaticEntity e, int x, int y) { bool worked = map.insert(e, x, y); if (worked) { Console.WriteLine("Gameworld inserted StaticEntity"); switch (e.getEntityType()) { case Entity.EntityType.Object: objects.Add((ObjectEntity)e); break; case Entity.EntityType.Resource: resources.Add((ResourceEntity)e); break; case Entity.EntityType.Building: Console.WriteLine("Inserted Building"); this.buildings.Add((Building)e); break; } } return(worked); }
/// <summary> /// Inserts a StaticEntity to the Map and the appropriate List, if possible. /// </summary> /// <param name="e">The StaticEntity to insert</param> /// <param name="x">The X-coordinate of the intended origin Cell</param> /// <param name="y">The Y-coordinate of the intended origin Cell</param> /// <returns>True if insertion was successful, false otherwise</returns> public bool insert(StaticEntity e, int x, int y) { bool worked = map.insert(e, x, y); if (worked) { switch (e.getEntityType()) { case Entity.EntityType.Object: objects.Add((ObjectEntity)e); break; case Entity.EntityType.Resource: resources.Add((ResourceEntity)e); break; case Entity.EntityType.Building: buildings.Add((Building)e); break; } } return(worked); }