Exemplo n.º 1
0
 //sets the target that the towers shoot at
 public void setTarget(Pcrane newTarget)
 {
     target = newTarget;
 }
Exemplo n.º 2
0
 //updates fireballs, towers, mouse clicks
 public void Update(GameTime theGameTime)
 {
     lastMouseState = mouseState;
     mouseState = Mouse.GetState();
     UpdateFireball(theGameTime);
     if (target != null && target.dead() == true)
     {
         target = null;
     }
     range.Update(theGameTime, mSpeed, mDirection);
     base.Update(theGameTime, mSpeed, mDirection);
     UpdateClick(mouseState, lastMouseState);
 }
Exemplo n.º 3
0
        private void UpdateCranes(GameTime theGameTime)
        {
            if (cranes.Count == 0 && state == State.spawned)
            {
                done = true;
            }

            for (int i = 0; i < cranes.Count; i++)
            {
                cranes[i].Update(theGameTime);
                if (cranes[i].dead() == true)
                {
                    cranes.Remove(cranes[i]);
                }
            }

            --cooldown;

            if (cooldown <= 0 && state == State.spawn)
            {
                Pcrane aCrane = new Pcrane();
                aCrane.LoadContent(mContentManager);
                cranes.Add(aCrane);
                aCrane.Scale = scale;
                aCrane.setHp(Hp);
                cooldown = 25;
                --unitCounter;
                if (unitCounter == 0)
                {
                    state = State.spawned;
                }
            }
        }