private void Update_Failed() { if (this.NamedEntities.ContainsKey("cover_rect") == false) { this.AddEntity(new RectEntity( "cover_rect", this.Width / 2, this.Height / 2, this.Width + 2, this.Height + 2, Color.FromArgb(0, Color.Black) )); // stop all moving objects foreach (Entity e in this.Entities) { if (e.Motion != null) { e.Motion.Speed = new Vector(0, 0); } e.RemoveTime = null; } } RectEntity r = this.NamedEntities["cover_rect"] as RectEntity; if (r.Color.A < 200) { r.Color = Color.FromArgb(r.Color.A + 5, r.Color.R, r.Color.G, r.Color.B); } else { // goto game over screen RaiseOnLeave(SceneType.GameOver); } }
private void Update_Completed() { if (this.NamedEntities.ContainsKey("cover_rect") == false) { RectEntity rect = new RectEntity( "cover_rect", this.Width / 2, this.Height / 2, this.Width + 2, this.Height + 2, Color.FromArgb(0, Color.Black) ); this.AddEntity(rect); // stop all moving objects foreach (Entity e in this.Entities) { if (e.Motion != null) { e.Motion.Speed = new Vector(0, 0); } e.RemoveTime = null; } this.MoveEntityToFront(Alien); this.animator = new EntityAnimator(); animator.AddAnimation(a => rect.Color = Color.FromArgb((int)a, rect.Color), 0, 255, 50); animator.AddAnimation(x => Alien.X = x, Alien.X, 200, 50, true); animator.AddAnimation(y => Alien.Y = y, Alien.Y, Height - 40, 50, true); animator.AddPause(20); animator.AddAnimation(() => Alien.Y, value => Alien.Y = value, -50, 30); } if (this.animator != null && this.animator.IsCompleted == false) { this.animator.Update(); } if (this.animator != null && this.animator.IsCompleted == true) { // goto intermission scene RaiseOnLeave(SceneType.Intermission, this); } }