Пример #1
0
 public void RemoveObject(GameObject aGameObject)
 {
     MapBlock lObjectBlock = aGameObject.Location;
     lObjectBlock.RemoveObject(aGameObject);
 }
Пример #2
0
        public void AddObjectAt(GameObject gObject, int x, int y)
        {
            gObject.AddObjectAt = new AddObjectAtDel(AddObjectAt);
            gObject.RemoveObject = new RemoveObjectDel(RemoveObject);

            if (gObject is Creature)
            {
                Creature lCreature = (Creature)gObject;
                mapBlocks[x, y].AddObject(lCreature);
                if (gObject is Zombie)
                {
                    mapZombies.Add(lCreature);
                }
                lCreature.MoveTo = new MoveObjectToDel(MoveObject);
            }
            else if (gObject is Prop)
            {
                mapBlocks[x, y].AddObject((Prop)gObject);
            }
            else if (gObject is Item)
            {
                mapBlocks[x, y].AddObject((Item)gObject);
            }

            if (gObject is Light)
            {
                lights.Add((Light)gObject);
            }
            gObject.Location = mapBlocks[x, y];
        }
Пример #3
0
 public void MoveObject(GameObject aGameObject, Coord aCoord)
 {
     if (this.IsInMap(aCoord))
     {
         aGameObject.Location.RemoveObject(aGameObject);
         AddObjectAt(aGameObject, aCoord.X, aCoord.Y);
     }
 }