public void Update(GameTime time) { Move(time); currentAnimation = path.Count > 0 ? moveAnimation : idleAnimation; currentAnimation.X = X; currentAnimation.Y = Y; currentAnimation.Update(time); }
void IXnaGameLoop.Initialize() { foreach (var type in Module.GenerateAnimations()) { Animations[type] = new MonoGameAnimationController(services.Make <AnimationModule>(type), services); } foreach (var type in Module.GenerateCharacterAnimations()) { CharacterAnimations[type] = new MonoGameCharacterAnimationController(services.Make <CharacterAnimationModule>(type), services); } foreach (var type in Module.GenerateCharacters()) { Characters[type] = new MonoGameCharacterController(services.Make <CharacterModule>(type), services); } foreach (var type in Module.GenerateItems()) { Items[type] = new MonoGameItemController(services.Make <ItemModule>(type), services); } foreach (var type in Module.GenerateInventoryItems()) { InventoryItems[type] = new MonoGameInventoryItemController(services.Make <InventoryItemModule>(type)); } foreach (var type in Module.GenerateRooms()) { Rooms[type] = new MonoGameRoomController(services.Make <RoomModule>(type), services); } PreInitialize(); Animations.Values.ToList().ForEach(a => a.PreInitialize()); CharacterAnimations.Values.ToList().ForEach(c => c.PreInitialize()); Characters.Values.ToList().ForEach(c => c.PreInitialize()); Items.Values.ToList().ForEach(i => i.PreInitialize()); InventoryItems.Values.ToList().ForEach(i => i.PreInitialize()); Rooms.Values.ToList().ForEach(r => r.PreInitialize()); Animations.Values.Select(a => a as IXnaGameLoop).ToList().ForEach(a => a.Initialize()); CharacterAnimations.Values.Select(c => c as IXnaGameLoop).ToList().ForEach(c => c.Initialize()); Characters.Values.Select(c => c as IXnaGameLoop).ToList().ForEach(c => c.Initialize()); Items.Values.Select(i => i as IXnaGameLoop).ToList().ForEach(i => i.Initialize()); InventoryItems.Values.Select(i => i as IXnaGameLoop).ToList().ForEach(i => i.Initialize()); Rooms.Values.Select(r => r as IXnaGameLoop).ToList().ForEach(r => r.Initialize()); }