public Body() : base("Body") { base.pos = new Vector2D(0, 0); vel = new Vector2D(0, 0); acc = new Vector2D(0, 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; } }
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)); }
public void SetTarget(Vector2D target) { this.target = target; }
private Environment() { audioContext = new AudioContext(); listenerPosition = listenerVelocity = new Vector2D(); }
public Entity(string name) : base(name) { pos = new Vector2D(0.0f, 0.0f); }
public static float Dot(Vector2D left, Vector2D right) { return (left.x * right.x) + (left.y * right.y); }
public static float Cross(Vector2D left, Vector2D right) { return (left.x * right.y) - (left.y * right.x); }
public void SetGravity(Vector2D gravity) { this.gravity = gravity; }
public PhysicsWorld() : base("PhysicsWorld") { gravity = new Vector2D(0, -9.8f); }