Exemplo n.º 1
0
 public DumbCop(PhysicsComponent2D phys, MovementAIComponent2D move, DrawComponent draw, DumbCopState pState,
     float radius)
 {
     movement = move;
     physics = phys;
     this.draw = draw;
     state = defaultState = pState;
     detectRadius = radius;
     this.BoundingRectangle = new COMP476Proj.BoundingRectangle(phys.Position, 16, 6);
     draw.Play();
 }
Exemplo n.º 2
0
 public DumbCop(PhysicsComponent2D phys, MovementAIComponent2D move, DrawComponent draw, DumbCopState pState)
 {
     detectRadius = 400;
     movement = move;
     physics = phys;
     this.draw = draw;
     behavior = DumbCopBehavior.DEFAULT;
     state = defaultState = pState;
     this.BoundingRectangle = new COMP476Proj.BoundingRectangle(phys.Position, 16, 6);
     draw.Play();
 }
Exemplo n.º 3
0
 private void transitionToState(DumbCopState pState)
 {
     if (state == pState)
     {
         return;
     }
     switch (pState)
     {
         case DumbCopState.STATIC:
             if (hasSeenTheStreaker)
             {
                 hasSeenTheStreaker = false;
                 --copsWhoSeeTheStreaker;
             }
             behavior = DumbCopBehavior.DEFAULT;
             state = DumbCopState.STATIC;
             draw.animation = SpriteDatabase.GetAnimation("cop_static");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.WANDER:
             if (hasSeenTheStreaker)
             {
                 hasSeenTheStreaker = false;
                 --copsWhoSeeTheStreaker;
             }
             behavior = DumbCopBehavior.DEFAULT;
             state = DumbCopState.WANDER;
             draw.animation = SpriteDatabase.GetAnimation("cop_walk");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.FALL:
             behavior = DumbCopBehavior.KNOCKEDUP;
             state = DumbCopState.FALL;
             draw.animation = SpriteDatabase.GetAnimation("cop_fall");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.GET_UP:
             behavior = DumbCopBehavior.KNOCKEDUP;
             state = DumbCopState.GET_UP;
             draw.animation = SpriteDatabase.GetAnimation("cop_getup");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.PATROL:
             if (hasSeenTheStreaker)
             {
                 hasSeenTheStreaker = false;
                 --copsWhoSeeTheStreaker;
             }
             state = DumbCopState.PATROL;
             draw.animation = SpriteDatabase.GetAnimation("cop_walk");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.PATHFIND:
             if (hasSeenTheStreaker)
             {
                 hasSeenTheStreaker = false;
                 --copsWhoSeeTheStreaker;
             }
             state = DumbCopState.PATHFIND;
             draw.animation = SpriteDatabase.GetAnimation("cop_walk");
             physics.SetSpeed(true);
             physics.SetAcceleration(true);
             draw.Reset();
             break;
         case DumbCopState.HIT:
             behavior = DumbCopBehavior.AWARE;
             state = DumbCopState.HIT;
             draw.animation = SpriteDatabase.GetAnimation("cop_attack");
             physics.SetSpeed(false);
             physics.SetAcceleration(false);
             draw.Reset();
             break;
         case DumbCopState.SEEK:
             if (!hasSeenTheStreaker)
             {
                 hasSeenTheStreaker = true;
                 ++copsWhoSeeTheStreaker;
                 if (!chasing)
                     DataManager.GetInstance().numberOfCopsChasing++;
                 chasing = true;
             }
             behavior = DumbCopBehavior.AWARE;
             state = DumbCopState.SEEK;
             draw.animation = SpriteDatabase.GetAnimation("cop_walk");
             physics.SetSpeed(true);
             physics.SetAcceleration(true);
             draw.Reset();
             break;
     }
 }