예제 #1
0
        public Vector2 Calculate(Arma arma, float secs)
        {
            if (Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                alvo = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
            }

            Vector2 desired = alvo - arma.getPosition();

            desired = Vector2.Normalize(desired) * arma.getMaxVelocidade();
            return(desired - arma.getVelocidade());
        }
        public Vector2 Calculate(Arma arma, float secs, Vector2 target)
        {
            if (Vector2.Distance(arma.getPosition(), target) > panic)
            {
                return(new Vector2());
            }

            Vector2 desired = arma.getPosition() - target;

            desired = Vector2.Normalize(desired) * arma.getMaxVelocidade();
            return(desired - arma.getVelocidade());
        }