internal void CreateSound(Vector3 position, Transformation BaseTransformation, Transformation AuxTransformation, int SectionIndex, double trackPosition) { int a = AnimatedWorldObjectsUsed; if (a >= AnimatedWorldObjects.Length) { Array.Resize <WorldObject>(ref AnimatedWorldObjects, AnimatedWorldObjects.Length << 1); } WorldSound snd = new WorldSound { Buffer = this.Buffer, //Must clone the vector, not pass the reference Position = new Vector3(position.X, position.Y, position.Z), Follower = new TrackManager.TrackFollower(), currentTrackPosition = trackPosition }; snd.Follower.Update(trackPosition, true, true); if (this.TrackFollowerFunction != null) { snd.TrackFollowerFunction = this.TrackFollowerFunction.Clone(); } AnimatedWorldObjects[a] = snd; AnimatedWorldObjectsUsed++; }
private void PlayBumpSound(float force) { if (bump_sound_prefab == null) { return; } //WorldSound s = ObjectPool.Instance.GetObject(bump_sound_prefab, false); WorldSound s = Instantiate(bump_sound_prefab); s.transform.position = transform.position; s.base_volume = Mathf.Pow(force, 2); s.SetPitchOffset(Random.Range(-0.15f, 0.15f)); s.Play(); }
// Use this for initialization void Start() { worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); worldSound = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldSound> (); actor = gameObject.GetComponent<Actor>(); ui = GameObject.FindGameObjectWithTag ("UIMain").GetComponent<UIMain> (); }
// Use this for initialization void Start() { movementInputTimer = Time.fixedTime; options = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameOptions> (); worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); worldSound = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldSound> (); move = gameObject.GetComponent<TileMovement>(); attack = gameObject.GetComponent<TileAttack>(); camera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera> (); actorManager = GameObject.FindGameObjectWithTag ("GameController").GetComponent<ActorManager> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); ui = GameObject.FindGameObjectWithTag ("UIMain").GetComponent<UIMain> (); }
// Setup public void SetupObjectReferences() { move = gameObject.GetComponent<TileMovement>(); attack = gameObject.GetComponent<TileAttack>(); worldMap = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldMap> (); worldSound = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WorldSound> (); ui = GameObject.FindGameObjectWithTag ("UIMain").GetComponent<UIMain> (); actorManager = GameObject.FindGameObjectWithTag ("GameController").GetComponent<ActorManager> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); options = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameOptions> (); animationPosition = new Vector2(tileX*worldMap.mapTileSize,tileY*worldMap.mapTileSize); }