Esempio n. 1
0
        public static double AngleInDegrees(Vec2 position)
        {
            double angle = System.Math.Atan2(position.TransformY, position.TransformX);

            angle = angle < 0 ? Math.Angles.RadiantsToDegree(angle + System.Math.PI) : Math.Angles.RadiantsToDegree(angle);
            return angle;
        }
Esempio n. 2
0
        public static Vec2 Add(this Vec2 me, Vec2 position)
        {
            me.TransformX = me.TransformX + position.TransformX;
            me.TransformY = me.TransformY + position.TransformY;

            return me;
        }
Esempio n. 3
0
        public static Vec2 Subtract(this Vec2 me, Vec2 position)
        {
            me.TransformX = me.TransformX - position.TransformX;
            me.TransformY = me.TransformY - position.TransformY;

            return me;
        }
Esempio n. 4
0
 public Mouse(Vec2 pos)
 {
     this.MouseId = MouseIds++;
     Points = 1;
     this.Scale = new Vec2(1, 1);
     this.Position = pos;
 }
Esempio n. 5
0
        public Vec2 Lerp(Vec2 start, Vec2 destination, double t)
        {
            Vec2 point = new Vec2();

            point.TransformX = (1 - t) * start.TransformX + t * destination.TransformX;
            point.TransformY = (1 - t) * start.TransformY + t * destination.TransformY;

            return point;
        }
Esempio n. 6
0
        public static double AngleInRadiants(Vec2 position)
        {
            double angle = System.Math.Atan2(position.TransformY, position.TransformX);

            return angle;
        }
Esempio n. 7
0
 public void SetVelocity(Vec2 velocity)
 {
     Velocity = velocity;
     RotateToPoint(velocity);
 }
Esempio n. 8
0
 public void RotateToPoint(Vec2 point)
 {
     Vec2 direction = point.Subtract(Position);
     Rotation = Angles.AngleInDegrees(direction);
 }
Esempio n. 9
0
 public void Move(Vec2 pos)
 {
     Position.TransformX = pos.TransformX;
     Position.TransformY = pos.TransformY;
 }