Example #1
0
 public Body()
     : base("Body")
 {
     base.pos = new Vector2D(0, 0);
     vel = new Vector2D(0, 0);
     acc = new Vector2D(0, 0);
 }
Example #2
0
        public void OnUpdate()
        {
            if (target != null) {
                Vector2D current = new Vector2D(position.getX(), position.getY());
                Vector2D difference = target - current;

                this.SetPosition(position.getX() + (difference.x*TWEEN_AMOUNT), this.position.getY() + (difference.y*TWEEN_AMOUNT), this.position.getZ());
            }

            if (shakeIntensity > SHAKE_END)
            {

                float x = (float)(random.NextDouble()-0.5) * shakeIntensity * 2;
                float y = (float)(random.NextDouble() - 0.5) * shakeIntensity * 2;
               // double z = (random.NextDouble() - 0.5) * shakeIntensity * 2; Shake on Z?

                this.viewOffset.setX(x);
                this.viewOffset.setY(y);

                shakeIntensity *= SHAKE_DISIPATE;
            }
            else {
                shakeIntensity = 0;
            }
        }
Example #3
0
        public void onUpdate()
        {
            if (target != null) {
                Vector2D current = new Vector2D(position.getX(), position.getY());
                Vector2D difference = target - current;

                this.setPosition(position.getX() + (difference.x*TWEEN_AMOUNT), this.position.getY() + (difference.y*TWEEN_AMOUNT), this.position.getZ());
            }
        }
        public AudioSource()
        {
            ALError e;

            loopSound = false;
            soundPosition = soundDirection = soundVelocity = new Vector2D();

            sourceHandle = AL.GenSource();

            if ((e = AL.GetError()) != ALError.NoError)
                Console.WriteLine("AL Error: AudioSource handle - " +
                    AL.GetErrorString(e));
        }
Example #5
0
 public void SetTarget(Vector2D target)
 {
     this.target = target;
 }
        private Environment()
        {
            audioContext = new AudioContext();

            listenerPosition = listenerVelocity = new Vector2D();
        }
Example #7
0
 public Entity(string name)
     : base(name)
 {
     pos = new Vector2D(0.0f, 0.0f);
 }
Example #8
0
 public static float Dot(Vector2D left, Vector2D right)
 {
     return (left.x * right.x) + (left.y * right.y);
 }
Example #9
0
 public static float Cross(Vector2D left, Vector2D right)
 {
     return (left.x * right.y) - (left.y * right.x);
 }
Example #10
0
 public void SetGravity(Vector2D gravity)
 {
     this.gravity = gravity;
 }
Example #11
0
 public PhysicsWorld()
     : base("PhysicsWorld")
 {
     gravity = new Vector2D(0, -9.8f);
 }