public override void Collide(GameObjects obj)
 {
     if (obj is Ship)
     {
         this.IsDestroyed = true;
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 public override void Collide(GameObjects obj)
 {
     if (obj is Ship)
     {
         (obj as Ship).ShipLife++;
         this.IsDestroyed = true;
     }
     else
     {
         this.IsDestroyed = true;
     }
 }
예제 #4
0
 public override void Collide(GameObjects obj)
 {
     if (obj is BonusStone)
     {
     }
     else
     {
         this.ShipLife--;
         if (this.ShipLife <= 0)
         {
             this.IsDestroyed = true;
         }
     }
 }
예제 #5
0
        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];   
                    }
                }
            }
        }
예제 #6
0
        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];
                    }
                }
            }
        }
예제 #7
0
 public void AddShip(GameObjects obj)
 {
     this.battleShip = obj as Ship;
     this.allObjects.Add(obj);
 }
예제 #8
0
 public void AddShip(GameObjects obj)
 {
     this.battleShip = obj as Ship;
     this.allObjects.Add(obj);
 }
예제 #9
0
 public virtual void Collide(GameObjects obj)
 {
     this.IsDestroyed = true;
 }
예제 #10
0
 public virtual void Collide(GameObjects obj)
 {
     this.IsDestroyed = true;
 }