예제 #1
0
 public Body()
     : base("Body")
 {
     base.pos = new Vector2D(0, 0);
     vel = new Vector2D(0, 0);
     acc = new Vector2D(0, 0);
 }
예제 #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;
            }
        }
예제 #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());
            }
        }
예제 #4
0
        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));
        }
예제 #5
0
 public void SetTarget(Vector2D target)
 {
     this.target = target;
 }
예제 #6
0
        private Environment()
        {
            audioContext = new AudioContext();

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