示例#1
0
 public Blast(Tank t,int xpos,int ypos,int ms,int d)
 {
     isAtStart  = true;
     fromTank = t;
     x = xpos;
     y = ypos;
     maxSize = ms;
     size = maxSize;
     damage = d;
 }
示例#2
0
 public Team(Game c, string tn)
 {
     r = new Random(seed);
     seed = Convert.ToInt32(System.DateTime.Now.Millisecond);
     creator = c;
     teamName = tn;
     tanks[0] = new Tank(creator,this,"tank1",r.Next(800),r.Next(200));//these should have random X,Y s
     tanks[1] = new Tank(creator,this,"tank2",r.Next(800),r.Next(200));
     tanks[2] = new Tank(creator,this,"tank3",r.Next(800),r.Next(200));
     tanks[3] = new Tank(creator,this,"tank4",r.Next(800),r.Next(200));
 }
示例#3
0
 public Projectile(Tank t, int fromX,int fromY,int initXvel,int initYvel)
 {
     fromTank = t;
     x = fromX;
     y = fromY;
     xvel = initXvel;
     yvel = initYvel;
     //
     // TODO: Add constructor logic here
     //
 }
示例#4
0
 public Team(Game c,gameClient g)
 {
     // Network Version Of Team
     r = new Random(seed);
     seed = Convert.ToInt32(System.DateTime.Now.Millisecond);
     creator = c;
     myClient = g;
     teamName = myClient.name;
     tanks[0] = new Tank(creator,this,"tank1",r.Next(800),r.Next(200));//these should have random X,Y s
     tanks[1] = new Tank(creator,this,"tank2",r.Next(800),r.Next(200));
     tanks[2] = new Tank(creator,this,"tank3",r.Next(800),r.Next(200));
     tanks[3] = new Tank(creator,this,"tank4",r.Next(800),r.Next(200));
 }
示例#5
0
 public void removeTank(Tank t)
 {
     t.isAlive = false;
     if(t.isCurrent)
     creator.nextTurn();
 }
示例#6
0
        public void nextTurn()
        {
            ready = false;
            counter = 0;
            // Keep going 'till you find a live one
            while(ready == false)
            {
                //go onto the next one, if on the last one go to the first one
                if(currentTank < 3)
                    {
                        currentTank++;
                    }
                    else
                    {
                        currentTank = 0;
                    }
                //if its health is greater than 0 its alive and your ready
                if(tanks[currentTank].health > 0 )
                {
                    ready = true;
                }
                else
                {
                    // other wise go onto the next one
                    counter++;
                    // might as well make sure the isAlive value is good.
                    tanks[currentTank].isAlive = false;
                    // if it reaches 4 the whole team must be dead.
                    if(counter>=4)
                    {
                        isDead = true;
                        break;
                    }
                }

            }
            currentTankObject = this.tanks[currentTank];
        }