public override void FocusTarget()
 {
     if (target.GetComponent<Character>().isAlive || target.GetComponentInChildren<Character>().isAlive)
     {
         FaceTarget();
         gun.Fire();
        
     }
     else return;
 }
Exemple #2
0
 //Shoot at the player
 public void Shoot(GameObject thingtoShootAt)
 {
     if (!gun.Fired)
     {
         //Vector2 diff = new Vector2 ( thingToShootAt.Position.X - Position.X, thingToShootAt.Position.Y - Position.Y);
         Matrix  m    = Matrix.CreateRotationZ(gun.Angle - ((float)Math.PI / 4));
         Vector2 diff = Vector2.Transform(Vector2.One, m);
         diff.Normalize();
         diff  = diff / 3;
         fired = gun.Fire(diff);
     }
 }