private void PlayToggleAnimation(bool playSound) { Vector3 eulerAngles = this.Switch.transform.eulerAngles; if (this.Toggled) { eulerAngles.y = 50; } else { eulerAngles.y = -50; } this.Switch.transform.eulerAngles = eulerAngles; // Sound logic if (this.name == "SoundController") { OptionManager.GetInstance().soundIsMuted = !this.Toggled; if (playSound) { SoundChannelManager.GetInstance().PlayClipAtPoint(this.ToggleSound, this.transform); } } else if (this.name == "MusicController") { OptionManager.GetInstance().musicIsMuted = !this.Toggled; if (playSound) { SoundChannelManager.GetInstance().PlayClipAtPoint(this.ToggleSound, this.transform); } } }
public static SoundChannelManager GetInstance() { if (instance == null) { instance = new SoundChannelManager(); } return instance; }
// Use this for initialization void Start() { scm = SoundChannelManager.GetInstance(); Physics.gravity = new Vector3(0, -30.0F, 0); // Manually change the gravity inputMngr = GetComponent <InputManager>(); rigidBodies = gameObject.GetComponentsInChildren <Rigidbody>(); rbInitPosition = new Vector3[rigidBodies.Length]; rbInitRotation = new Quaternion[rigidBodies.Length]; lifeIcons = new GameObject[lives]; // Relay Collission to every parents with the function OnCollisionInChildren int i = 0; foreach (Rigidbody rb in rigidBodies) { rb.gameObject.AddComponent <RelayCollision>(); rbInitPosition[i] = rb.transform.position; rbInitRotation[i] = rb.transform.rotation; i++; } if (heatBar != null) { heatBarParticleSystem = heatBar.GetComponentInChildren <ParticleEmitter>(); heatBarTube = heatBar.transform.FindChild("HeatBarModel").FindChild("TransparentTube").gameObject; defaultHeatBarTubeColor = heatBarTube.renderer.material.color; } else { Debug.LogWarning("heatbar is unset"); } createLivesHud(); }
// Use this for initialization void Start() { // this.enabled = false; // //sound logic if (OptionManager.GetInstance().musicIsMuted == false) { SoundChannelManager.GetInstance().playMusic(); } GameObject fadeText = iTween.CameraFadeAdd(); iTween.CameraFadeDepth(12); Color ncolor = fadeText.guiTexture.color; ncolor.a = 1.0f; fadeText.guiTexture.color = ncolor; iTween.CameraFadeTo(iTween.Hash( "amount", 0.0f, "time", 1.5f, "easetype", iTween.EaseType.easeOutExpo )); this.camera.fieldOfView = 18; }
public static SoundChannelManager GetInstance() { if (instance == null) { instance = new SoundChannelManager(); } return(instance); }
public void Push() { this.GetComponent <Animator>().SetTrigger("Push"); if (this.PushSound) { SoundChannelManager.GetInstance().PlayClipAtPoint(this.PushSound, this.transform); } }
private void UpdateHingeJoints() { // Front Part if (inputMngr.RightButtonUnrealised) { if (!hingeFrontUnfold) { hingeFrontUnfold = true; SoundChannelManager.GetInstance().PlayClipAtPoint(hingeUnfold, leftFrontHinge.transform); } JointSpring JPTemp = leftFrontHinge.spring; JPTemp.targetPosition = -10; leftFrontHinge.spring = JPTemp; rightFrontHinge.spring = JPTemp; } else { if (hingeFrontUnfold) { hingeFrontUnfold = false; SoundChannelManager.GetInstance().PlayClipAtPoint(hingeFold, leftFrontHinge.transform); } JointSpring JPTemp = leftFrontHinge.spring; JPTemp.targetPosition = -120; leftFrontHinge.spring = JPTemp; rightFrontHinge.spring = JPTemp; } // Back Part if (inputMngr.LeftButtonUnrealised) { if (!hingeBackUnfold) { hingeBackUnfold = true; SoundChannelManager.GetInstance().PlayClipAtPoint(hingeUnfold, leftBackHinge.transform); } JointSpring JPTemp = leftBackHinge.spring; JPTemp.targetPosition = -10; leftBackHinge.spring = JPTemp; rightBackHinge.spring = JPTemp; } else { if (hingeBackUnfold) { hingeBackUnfold = false; SoundChannelManager.GetInstance().PlayClipAtPoint(hingeFold, leftBackHinge.transform); } JointSpring JPTemp = leftBackHinge.spring; JPTemp.targetPosition = -120; leftBackHinge.spring = JPTemp; rightBackHinge.spring = JPTemp; } }
public void Open() { if (this.isOpen) { return; } this.isOpen = true; foreach (GameObject go in this.anchors) { go.GetComponent <Animator>().SetBool("Open", this.isOpen); } if (this.OpenSound) { SoundChannelManager.GetInstance().PlayClipAtPoint(this.OpenSound, this.transform); } }
void OnCollisionInChildren(Collision collision) { GameObject me = transform.gameObject; GameObject other = collision.collider.transform.root.gameObject; if ((me.CompareTag("Player1") && other.CompareTag("Player2")) || (me.CompareTag("Player2") && other.CompareTag("Player1"))) { if (collision.collider.rigidbody && me.GetComponent <Dash>().IsDashing&& !other.GetComponent <Dash>().IsDashing) { // The feet don't have rigidbody this can be a problem SoundChannelManager.GetInstance().PlayClipAtPoint(me.GetComponent <WildCatController>().hitSFX, collision.transform); SoundChannelManager.GetInstance().PlayClipAtPoint(me.GetComponent <WildCatController>().flySFX, collision.transform); collision.collider.rigidbody.AddForce(collision.rigidbody.velocity + (me.GetComponent <Dash>().DashingDirections == InputManager.Direction.Left ? Vector3.left : Vector3.right) * 20f, ForceMode.Impulse); } else { SoundChannelManager.GetInstance().PlayClipAtPoint(me.GetComponent <WildCatController>().lowHitSFX, collision.transform); } } }
// Use this for initialization void Start() { scm = SoundChannelManager.GetInstance(); Physics.gravity = new Vector3 (0, -30.0F, 0); // Manually change the gravity inputMngr = GetComponent<InputManager>(); rigidBodies = gameObject.GetComponentsInChildren<Rigidbody>(); rbInitPosition = new Vector3[rigidBodies.Length]; rbInitRotation = new Quaternion[rigidBodies.Length]; lifeIcons = new GameObject[lives]; // Relay Collission to every parents with the function OnCollisionInChildren int i = 0; foreach (Rigidbody rb in rigidBodies) { rb.gameObject.AddComponent<RelayCollision>(); rbInitPosition[i] = rb.transform.position; rbInitRotation[i] = rb.transform.rotation; i++; } if (heatBar != null) { heatBarParticleSystem = heatBar.GetComponentInChildren<ParticleEmitter>(); heatBarTube = heatBar.transform.FindChild("HeatBarModel").FindChild("TransparentTube").gameObject; defaultHeatBarTubeColor = heatBarTube.renderer.material.color; } else { Debug.LogWarning("heatbar is unset"); } createLivesHud(); }