public override void CollideAction(GameObject obj) { if (obj is WallBlock || obj is Enemy) { this.Speed.XPosition *= -1; } else { this.Lifes--; if (this.Lifes == 0) { this.isAlive = false; } if (!isAlive && height > 1) { this.Lifes = 3; isAlive = true; height--; char[,] newBody = new char[height, body.GetLength(1)]; for (int i = 0; i < height; i++) { for (int j = 0; j < body.GetLength(1); j++) { newBody[i, j] = this.body[i, j]; } } this.body = newBody; } } }
public override void CollideAction(GameObject obj) { if (obj is WallBlock || obj is Enemy) { this.Speed.XPosition *= -1; } else { this.Lifes--; if (this.Lifes == 0) { this.isAlive = false; } } }
public void AddObject(GameObject obj) { if (obj is PlayerShip) { AddShip(obj); } else if (obj is MovingObject) { this.AddMovingObject(obj); } else { this.AddStaticObject(obj); } }
public override void CollideAction(GameObject obj) { if (obj is WallBlock && obj.ObjectCoordinates.XPosition==0) { MoveRight(); } else if (obj is WallBlock && obj.ObjectCoordinates.XPosition!=0) { MoveLeft(); } else if (!(obj is WallBlock)) { this.Lifes--; if (this.Lifes == 0) { this.isAlive = false; } } }
public override void CollideAction(GameObject obj) { this.isAlive = false; }
public abstract void CollideAction(GameObject obj);
public override void CollideAction(GameObject obj) { }
private void AddStaticObject(GameObject obj) { staticObjects.Add(obj); allObjects.Add(obj); }
private void AddShip(GameObject obj) { this.playerShip = obj as PlayerShip; this.allObjects.RemoveAll(x => x is PlayerShip); this.AddMovingObject(obj); }
private void AddMovingObject(GameObject movingObj) { this.movingObjects.Add(movingObj); this.allObjects.Add(movingObj); }