public override void Initialize() { base.Initialize(); _weaponManager.Initialize(); _shields.LoadContent(); _shields.PrepareAnimation(128, 128); _shields.AddAnimation("smallBlack", new int[] { 0, 1 }, 120, false); _shields.AddAnimation("blueStrong", new int[] { 2, 3 }, 120, false); _shields.AddAnimation("redStrong", new int[] { 4, 5 }, 120, false); _shields.AddAnimation("blueLight", new int[] { 6, 7 }, 120, false); _shields.Active = false; PrepareAnimation(64, 64); AddAnimation("idle", new int[] { 0 }, 0, false); AddAnimation("move", new int[] { 1, 2 }, 35, false); Reset(); }
public override void Initialize() { base.Initialize(); Registry.AudioManager.PlayMusic("Audio/DST-DustLoop"); Registry.AudioManager.VocalRate = -2; Registry.AudioManager.SpeakAsync("Welcome Commander !"); _title.Position = new Vector2(YnG.Width / 2 - _title.Width / 2, 25); _kinectLogo.Position = new Vector2(YnG.Width - _kinectLogo.Width - 10, YnG.Height - _kinectLogo.Height - 10); _planetLogo.Scale = new Vector2(1.2f, 1.2f); _planetLogo.Position = new Vector2(-30, YnG.Height - _planetLogo.Height / 2); _shipSprite.LoadContent(); _shipSprite.Position = new Vector2(195, _planetLogo.Y - 95); _shipSprite.PrepareAnimation(64, 64); _shipSprite.AddAnimation("fire", new int[] { 1, 2 }, 370, false); _shipSprite.Rotation = MathHelper.ToRadians(30); _shipSprite.Scale = new Vector2(1.5f); }
public void AddExplosion(Rectangle rectangle) { YnSprite explode; int recycledSize = _recycled.Count; if (recycledSize > 0) { explode = Members.ElementAt(_recycled.Pop()) as YnSprite; explode.Position = new Vector2( (rectangle.X + rectangle.Width / 2) - (explode.Width / 5) / 2, (rectangle.Y + rectangle.Height / 2) - explode.Height / 2); explode.Revive(); } else { explode = new YnSprite("SFX/Fx_Fireball"); explode.LoadContent(); explode.PrepareAnimation(94, 94); explode.AddAnimation("0", new int[] { 0, 1, 2, 3, 4 }, 50, false); explode.Scale = new Vector2(0.75f); explode.Position = new Vector2( (rectangle.X + rectangle.Width / 2) - (explode.Width / 5) / 2, (rectangle.Y + rectangle.Height / 2) - explode.Height / 2); // On supprime l'animation quand elle est terminée explode.GetAnimation("0").AnimationComplete += (sender, e) => { explode.Kill(); _recycled.Push(Members.IndexOf(explode)); }; Add(explode); } }