Example #1
0
 void Scan()
 {
     State = RobotSentinelStates.Scanning;
       LastScan = Game1.CurrentTime;
       Scanner = new ScanningCircle(new Vector2(DrawBox.Center.X, DrawBox.Bottom), SCANNING_RANGE, SCANNING_SPEED);
 }
Example #2
0
        public override void Update(GameTime gameTime)
        {
            switch (State)
              {
            case RobotSentinelStates.Walking:
              Velocity.X = Direction * WALKING_SPEED;

              if (DrawBox.Center.X <= LeftBounds)
            Velocity.X = Math.Abs(Velocity.X);

              if (DrawBox.Center.X >= RightBounds)
            Velocity.X = -Math.Abs(Velocity.X);

              if (Game1.CurrentTime - LastScan > TimeBetweenScans)
            Scan();
              break;

            case RobotSentinelStates.Scanning:
              Velocity.X = 0;

              if (Game1.CurrentTime - LastScan > ScanDuration)
            RestoreState();
              break;

            case RobotSentinelStates.Attacking:
              Velocity.X = 0;
              Game1.EventMan.Notify(Events.PlayerHitByLaser, this);

              if (Game1.CurrentTime - LastAttack > AttackDuration)
            RestoreState();

              break;
              }

              if (Scanner != null)
              {
            if (Scanner.Destroy)
              Scanner = null;
            else
              Scanner.Update(gameTime);
              }

              UpdateMovement(gameTime);
        }
Example #3
0
 void RestoreState()
 {
     State = RobotSentinelStates.Walking;
       Scanner = null;
 }
Example #4
0
 public void PlayerSpottedByScanner(object nothing)
 {
     if (Target != null)
       {
     if (Target.State == Player.PlayerStates.Standing
       || Target.State == Player.PlayerStates.Walking
       || Target.State == Player.PlayerStates.Shooting)
     {
       State = RobotSentinelStates.Attacking;
       Scanner = null;
       LastAttack = Game1.CurrentTime;
     }
       }
 }