public FireballMissile(Zerd zerd, DamageInstance damageInstance, Point p) : base("Missiles/fireball.png") { Damage = damageInstance; var size = 64f * zerd.SkillValue(SkillType.ImprovedFireball, true); Width = (int)size; Height = (int)size; X = p.X; Y = p.Y; Creator = zerd; Origin = p; Distance = AbilityConstants.FireballDistance; Speed = AbilityConstants.FireballSpeed; Velocity = Creator.Facing.Normalized(); Animations = new AnimationList(); var moveAnimation = new Animation(AnimationTypes.Move); moveAnimation.AddFrame(new Rectangle(64 * 0, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 1, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 2, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 3, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 4, 0, 64, 64), TimeSpan.FromSeconds(0.1)); moveAnimation.AddFrame(new Rectangle(64 * 5, 0, 64, 64), TimeSpan.FromSeconds(0.1)); Animations.Add(moveAnimation); var deathAnimation = new Animation(AnimationTypes.Death); deathAnimation.AddFrame(new Rectangle(64 * 6, 0, 64, 64), TimeSpan.FromSeconds(0.1)); deathAnimation.AddFrame(new Rectangle(64 * 7, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.92f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 8, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.84f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 9, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.76f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 10, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.68f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 11, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.6f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 12, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.5f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 13, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.4f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 14, 0, 64, 64), TimeSpan.FromSeconds(0.1), () => { Opacity = 0.3f; return(true); }); deathAnimation.AddFrame(new Rectangle(64 * 15, 0, 64, 64), TimeSpan.FromSeconds(0.1), DeathFunc); Animations.Add(deathAnimation); }
public void Update(GameTime gameTime) { if (Zerd == null || !Zerd.IsAlive) { return; } var controller = InputService.InputDevices[PlayerIndex]; Zerd.ControllerUpdate(controller.LeftTrigger, controller.RightTrigger, controller.LeftStickDirection, controller.RightStickDirection); var buttonsPressed = InputService.InputDevices[PlayerIndex].ButtonsPressed; var buttonsReleased = InputService.InputDevices[PlayerIndex].ButtonsReleased; if (Zerd.GetCurrentAnimationType() == AnimationTypes.Stand || Zerd.GetCurrentAnimationType() == AnimationTypes.Move) { if (ChargeAbilities) { if (InputService.InputDevices[PlayerIndex].LeftStickIn) { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.StartCharge(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.StartCharge(); } if (buttonsReleased.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.ReleaseCharge(); } } else { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).StartCharge(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).StartCharge(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).StartCharge(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).StartCharge(); } if (buttonsPressed.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.StartCharge(); } if (buttonsReleased.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).ReleaseCharge(); } if (buttonsReleased.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.ReleaseCharge(); } } } else { if (InputService.InputDevices[PlayerIndex].LeftStickIn) { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.FrostPound)?.Cast(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.DragonsBreath)?.Cast(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Icicle)?.Cast(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.LavaBlast)?.Cast(); } } else { if (buttonsPressed.Contains(Buttons.A)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Wand).Cast(); } if (buttonsPressed.Contains(Buttons.B)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Iceball).Cast(); } if (buttonsPressed.Contains(Buttons.X)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Fireball).Cast(); } if (buttonsPressed.Contains(Buttons.Y)) { Zerd.Abilities.First(a => a.Type == AbilityTypes.Dash).Cast(); } if (buttonsPressed.Contains(Buttons.RightShoulder)) { Zerd.Abilities.FirstOrDefault(a => a.Type == AbilityTypes.Charm)?.Cast(); } } } } if (InputService.InputDevices[PlayerIndex].RightTrigger > CodingConstants.TriggerPress && Zerd.Mana > 1) { Zerd.Mana -= Zerd.BootItem.SprintManaPerSecond * (float)gameTime.ElapsedGameTime.TotalSeconds * Globals.GameState.GameSpeed * (1 - Zerd.SkillValue(SkillType.Sprinter, false) / 100); if (!Zerd.Buffs.Any(b => b is SprintBuff)) { Zerd.Buffs.Add(new SprintBuff(Zerd, Zerd.BootItem.SprintBonus)); } } else { if (Zerd.Buffs.Any(b => b is SprintBuff)) { Zerd.Buffs.Remove(Zerd.Buffs.First(b => b is SprintBuff)); } } }