예제 #1
0
파일: Tower.cs 프로젝트: Xeiphyer/TDGame
 //sets the target that the towers shoot at
 public void setTarget(Pcrane newTarget)
 {
     target = newTarget;
 }
예제 #2
0
파일: Tower.cs 프로젝트: Xeiphyer/TDGame
 //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);
 }
예제 #3
0
파일: waves.cs 프로젝트: Xeiphyer/TDGame
        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;
                }
            }
        }