Exemplo 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;
        }
Exemplo 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;
        }
Exemplo 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;
        }
Exemplo n.º 4
0
 public Mouse(Vec2 pos)
 {
     this.MouseId = MouseIds++;
     Points = 1;
     this.Scale = new Vec2(1, 1);
     this.Position = pos;
 }
Exemplo 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;
        }
Exemplo n.º 6
0
        public static double AngleInRadiants(Vec2 position)
        {
            double angle = System.Math.Atan2(position.TransformY, position.TransformX);

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