示例#1
0
        private void explode(Granade explodedGranade)
        {
            for (int i = 0; i < 8; i++)
            {
                Splinter splinter = new Splinter();
                splinter.setCoordinate = explodedGranade.getGranade.Location;
                splinter.movement.Add(Splinter.movementProperties[i, 0]);
                splinter.movement.Add(Splinter.movementProperties[i, 1]);

                splinters.Add(splinter);
            }
        }
示例#2
0
        //update Splinters
        private void updateSplinters()
        {
            for (int i = 0; i < splinters.Count; i++)
            {
                Splinter tempSplinter = (Splinter)splinters[i];

                foreach (object o in tempSplinter.movement)
                {
                    if (o.ToString() == "x++")
                    {
                        tempSplinter.getSplinter.Location = new Point(tempSplinter.getSplinter.Location.X + movementAmmount, tempSplinter.getSplinter.Location.Y);
                    }
                    else if (o.ToString() == "x--")
                    {
                        tempSplinter.getSplinter.Location = new Point(tempSplinter.getSplinter.Location.X - movementAmmount, tempSplinter.getSplinter.Location.Y);
                    }
                    else if (o.ToString() == "y++")
                    {
                        tempSplinter.getSplinter.Location = new Point(tempSplinter.getSplinter.Location.X, tempSplinter.getSplinter.Location.Y + movementAmmount);
                    }
                    else if (o.ToString() == "y--")
                    {
                        tempSplinter.getSplinter.Location = new Point(tempSplinter.getSplinter.Location.X, tempSplinter.getSplinter.Location.Y - movementAmmount);
                    }
                }
                canvas.Controls.Add(tempSplinter.getSplinter);

                //if player is Hitted By splinters
                if (GameStatus.isPlayerHited(tempSplinter.getSplinter, tempSplinter.getSplinter.Location, isPlayerAtDown))
                {
                    canvas.Controls.Remove(tempSplinter.getSplinter);
                    splinters.Remove(tempSplinter);
                    vehicleDamage.Play();
                }

                tempSplinter.destructionPoint -= 10;

                if (tempSplinter.destructionPoint == 0)
                {
                    canvas.Controls.Remove(tempSplinter.getSplinter);
                    splinters.Remove(tempSplinter);
                }
            }
        }
示例#3
0
        private void explode(Morter tempMorter)
        {
            int i, j;

            if (isPlayerAtDown)
            {
                i = 0; j = 3;
            }
            else
            {
                i = 5; j = 8;
            }

            for ( ; i < j; i++)
            {
                Splinter splinter = new Splinter();
                splinter.setCoordinate = tempMorter.getMorter.Location;
                splinter.movement.Add(Splinter.movementProperties[i, 0]);
                splinter.movement.Add(Splinter.movementProperties[i, 1]);
                splinter.destructionPoint = 100;

                splinters.Add(splinter);
            }
        }