Пример #1
0
        public bool Move(Vector2 target, GameTime gameTime)
        {
            Vector2 moveVec = CalcTowards(target, gameTime);
            double  angle   = Math.Atan2(moveVec.Y, moveVec.X);

            if ((target - pos).Length() < 1)
            {
                job = WolfJob.Idle;
                return(true);
            }
            else
            {
                moveVec = MoveTowards(target, gameTime);

                if (Math.Abs(angle) >= (Math.PI * (3d / 4d)))
                {
                    job = WolfJob.WLeft;
                }
                else if (Math.Abs(angle) <= Math.PI / 4)
                {
                    job = WolfJob.WRight;
                }
                else if (angle <= 0)
                {
                    job = WolfJob.WUp;
                }
                else if (angle >= 0)
                {
                    job = WolfJob.WDown;
                }
                return(false);
            }
        }
Пример #2
0
 public void Attack(GameTime gameTime)
 {
     job            = WolfJob.Bite;
     target.Health -= damage * (float)gameTime.ElapsedGameTime.TotalSeconds;
 }