static public _3D_ATTRIBUTES to3DAttributes(this Vector3 pos) { FMOD.Studio._3D_ATTRIBUTES attributes = new FMOD.Studio._3D_ATTRIBUTES(); attributes.forward = toFMODVector(Vector3.forward); attributes.up = toFMODVector(Vector3.up); attributes.position = toFMODVector(pos); return(attributes); }
public static _3D_ATTRIBUTES to3DAttributes(this Vector3 pos) { FMOD.Studio._3D_ATTRIBUTES attributes = new FMOD.Studio._3D_ATTRIBUTES(); attributes.forward = toFMODVector(Vector3.forward); attributes.up = toFMODVector(Vector3.up); attributes.position = toFMODVector(pos); return attributes; }
public static _3D_ATTRIBUTES to3DAttributes(GameObject go, Rigidbody rigidbody = null) { FMOD.Studio._3D_ATTRIBUTES attributes = new FMOD.Studio._3D_ATTRIBUTES(); attributes.forward = toFMODVector(go.transform.forward); attributes.up = toFMODVector(go.transform.up); attributes.position = toFMODVector(go.transform.position); if (rigidbody) attributes.velocity = toFMODVector(rigidbody.velocity); return attributes; }
static public _3D_ATTRIBUTES to3DAttributes(this GameObject go) { FMOD.Studio._3D_ATTRIBUTES attributes = new FMOD.Studio._3D_ATTRIBUTES(); attributes.forward = toFMODVector(go.transform.forward); attributes.up = toFMODVector(go.transform.up); attributes.position = toFMODVector(go.transform.position); if (go.rigidbody) { attributes.velocity = toFMODVector(go.rigidbody.velocity); } return(attributes); }
public Attributes3D(ref _3D_ATTRIBUTES attr) : this(attr.position.FromFmod(), attr.velocity.FromFmod(), attr.forward.FromFmod(), attr.up.FromFmod()) { }
private void Form1_KeyDown(object sender, KeyEventArgs e) { #if DEBUG if (e.KeyCode == Keys.NumPad1) { game.player.RotationDegree -= 1; if (game.player.RotationDegree == -360) { game.player.RotationDegree = 0; } } if (e.KeyCode == Keys.NumPad2) { game.player.RotationDegree += 1; if (game.player.RotationDegree == 360) { game.player.RotationDegree = 0; } } if (e.KeyCode == Keys.NumPad0) { game.player.RotationDegree = 0; } if (e.KeyCode == Keys.NumPad7) { game.player.WeaponID -= 1; if (game.player.WeaponID < 0) { game.player.WeaponID = 0; } game.SetPlayerWeapon(game.player.WeaponID); } if (e.KeyCode == Keys.NumPad8) { game.player.WeaponID += 1; if (game.player.WeaponID > game.Weapons.Count) { game.player.WeaponID = 0; } game.SetPlayerWeapon(game.player.WeaponID); } if (e.KeyCode == Keys.End) { game.player.ApplyDamage(20, game.player); } #endif if (game.WorldScrollEnabled == true) { if (e.KeyCode == Keys.Up) { float sy = game.player.GetY(); game.player.Collision.Y -= game.player.Speed / 2; game.player.LastMoveDirection = MoveDirection.UP; if (game.player.Collision.Y < 0) { game.player.Collision.Y = 0; } game.CheckPlayerCollision(); if (sy != game.player.GetY()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.Y += game.player.Speed / 2; } } } if (e.KeyCode == Keys.Down) { float sy = game.player.GetY(); game.player.Collision.Y += game.player.Speed / 2; game.player.LastMoveDirection = MoveDirection.DOWN; game.CheckPlayerCollision(); if (sy != game.player.GetY()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.Y -= game.player.Speed / 2; } } } if (e.KeyCode == Keys.Left) { float sx = game.player.GetX(); game.player.Collision.X -= game.player.Speed / 2; game.player.LastMoveDirection = MoveDirection.LEFT; if (game.player.Collision.X < 0) { game.player.Collision.X = 0; } game.CheckPlayerCollision(); if (sx != game.player.GetX()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.X += game.player.Speed / 2; } } } if (e.KeyCode == Keys.Right) { float sx = game.player.GetX(); game.player.Collision.X += game.player.Speed / 2; game.player.LastMoveDirection = MoveDirection.RIGHT; game.CheckPlayerCollision(); if (sx != game.player.GetX()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.X -= game.player.Speed / 2; } } } } else { if (e.KeyCode == Keys.Up) { float sy = game.player.GetY(); game.player.Collision.Y -= game.player.Speed; game.player.LastMoveDirection = MoveDirection.UP; if (game.player.Collision.Y < 0) { game.player.Collision.Y = 0; } game.CheckPlayerCollision(); if (sy != game.player.GetY()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.Y += game.player.Speed; } } } if (e.KeyCode == Keys.Down) { float sy = game.player.GetY(); game.player.Collision.Y += game.player.Speed; game.player.LastMoveDirection = MoveDirection.DOWN; game.CheckPlayerCollision(); if (sy != game.player.GetY()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.Y -= game.player.Speed; } } } if (e.KeyCode == Keys.Left) { float sx = game.player.GetX(); game.player.Collision.X -= game.player.Speed; game.player.LastMoveDirection = MoveDirection.LEFT; if (game.player.Collision.X < 0) { game.player.Collision.X = 0; } game.CheckPlayerCollision(); if (sx != game.player.GetX()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.X += game.player.Speed; } } } if (e.KeyCode == Keys.Right) { float sx = game.player.GetX(); game.player.Collision.X += game.player.Speed; game.player.LastMoveDirection = MoveDirection.RIGHT; game.CheckPlayerCollision(); if (sx != game.player.GetX()) { for (int i = 0; i < game.world.World_Actors.Count; i++) { game.world.World_Actors.ElementAt(i).Collision.X -= game.player.Speed; } } } } game.PlayerViewArea.X = game.player.GetX() - game.PlayerViewRadius; game.PlayerViewArea.Y = game.player.GetY() - game.PlayerViewRadius; FMOD.Studio._3D_ATTRIBUTES attrib = new FMOD.Studio._3D_ATTRIBUTES(); attrib.position = Vector.ToVECTOR(game.player.GetX(), game.player.GetY(), 0); attrib.up = Vector.ToVECTOR(0, 1, 0); attrib.velocity = Vector.ToVECTOR(0, 0, 0); attrib.forward = Vector.ToVECTOR(1, 0, 0); RESULT r = game.Sound_System.setListenerAttributes(0, attrib); if (r != RESULT.OK) { MessageBox.Show(FMOD.Error.String(r)); } game.Sound_System.update(); FMOD.Studio._3D_ATTRIBUTES attrib1 = new FMOD.Studio._3D_ATTRIBUTES(); game.Sound_System.getListenerAttributes(0, out attrib1); Refresh(); }