Ejemplo n.º 1
0
        public virtual void Update(InputManager inputmanager, float deltatime)
        {
            foreach (var map in Maps.Values)
            {
                if (map.IsActive())
                {
                    map.Update(inputmanager, deltatime);
                }
            }

            Map[] maparray = new Map[Maps.Values.Count];
            Maps.Values.CopyTo(maparray, 0);

            foreach (var map in maparray)
            {
                map.Entities.HandleDoors();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the map.
        /// </summary>
        /// <param name="inputmanager">The input manager from which to receive player packets. </param>
        /// <param name="deltatime">The speed at which the map should change.</param>
        public virtual void Update(InputManager inputmanager, float deltatime)
        {
            foreach (var tile in TileSet)
            {
                tile.Update(deltatime);
            }

            foreach (var logic in Logics)
            {
                logic.Update(deltatime);
            }

            foreach (var backdrop in Backdrops)
            {
                backdrop.Value.Update(deltatime);
            }

            foreach (var foredrop in Foredrops)
            {
                foredrop.Value.Update(deltatime);
            }

            Entities.Update(inputmanager, deltatime);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Updates the entities
 /// </summary>
 /// <param name="inputmanager">The input manager for gathering input..</param>
 /// <param name="deltatime">The time since last frame.</param>
 /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Unsupported player type in Entity.</exception>
 public virtual void Update(InputManager inputmanager, float deltatime)
 {
     foreach (var entity in Entities.Values)
     {
         switch (entity.InputType)
         {
             case InputType.NPC:
                 entity.Update(entity.GetAIPacket(), deltatime);
                 break;
             case InputType.Player1:
                 entity.Update(inputmanager.GetPlayer1Packet(), deltatime);
                 break;
             case InputType.Player2:
                 entity.Update(inputmanager.GetPlayer2Packet(), deltatime);
                 break;
             case InputType.Player3:
                 entity.Update(inputmanager.GetPlayer3Packet(), deltatime);
                 break;
             case InputType.Player4:
                 entity.Update(inputmanager.GetPlayer4Packet(), deltatime);
                 break;
                 case InputType.World:
                 entity.Update(null, deltatime); //We will send a lack of a packet, so we can update animation, but not handle any logic.
                 break;
             default:
                 throw new InvalidEnumArgumentException("Unsupported player type in Entity.");
         }
     }
 }