public override void Collide(GameObjects obj) { if (obj is Ship) { this.IsDestroyed = true; } }
public void AddObject(GameObjects obj) { if (obj is Stone) { this.allStones.Add(obj as Stone); } else if (obj is Gun) { this.allBullets.Add(obj as Gun); } this.allObjects.Add(obj); }
public override void Collide(GameObjects obj) { if (obj is Ship) { (obj as Ship).ShipLife++; this.IsDestroyed = true; } else { this.IsDestroyed = true; } }
public override void Collide(GameObjects obj) { if (obj is BonusStone) { } else { this.ShipLife--; if (this.ShipLife <= 0) { this.IsDestroyed = true; } } }
public void EnqueObject(GameObjects obj) { char[,] objImage = obj.GetImage(); int objRows = objImage.GetLength(0); int objCols = objImage.GetLength(1); Position objPosition = obj.GetPosition; for (int i = obj.GetPosition.Row; i < (objPosition.Row + objRows); i++) { for (int j = obj.GetPosition.Col; j < (objPosition.Col + objCols); j++) { if (i >= 0 && i < gameFieldRows && j >=0 && j < gameFieldCols) { objectsMatrix[i, j] = objImage[i - objPosition.Row, j - objPosition.Col]; } } } }
public void EnqueObject(GameObjects obj) { char[,] objImage = obj.GetImage(); int objRows = objImage.GetLength(0); int objCols = objImage.GetLength(1); Position objPosition = obj.GetPosition; for (int i = obj.GetPosition.Row; i < (objPosition.Row + objRows); i++) { for (int j = obj.GetPosition.Col; j < (objPosition.Col + objCols); j++) { if (i >= 0 && i < gameFieldRows && j >= 0 && j < gameFieldCols) { objectsMatrix[i, j] = objImage[i - objPosition.Row, j - objPosition.Col]; } } } }
public void AddShip(GameObjects obj) { this.battleShip = obj as Ship; this.allObjects.Add(obj); }
public virtual void Collide(GameObjects obj) { this.IsDestroyed = true; }