void FixedUpdate() { if (networkView.isMine) { if (PlayerEndOfPartyScript.PlayingState) { if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.Q)) { Body.transform.Rotate(0.0f, -AngularSpeed * Time.deltaTime, 0.0f); } if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) { Body.transform.Rotate(0.0f, AngularSpeed * Time.deltaTime, 0.0f); } if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.Z)) { Body.transform.Translate(Vector3.forward * Time.deltaTime * Speed); } if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) { Body.transform.Translate(Vector3.back * Time.deltaTime * Speed); } if (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.Keypad0)) { if (jumpReloaded) { Source.PlayOneShot(JumpSound); jumpReloaded = false; Body.AddForce(Vector3.up * Time.deltaTime * 10000.0f, ForceMode.Acceleration); Invoke("ReloadJump", 1.0f); } } } DidactitielScript scriptt = GameObject.Find("OnLoadPlay").GetComponent <DidactitielScript>(); if (!sound_run && scriptt.IsStep(3)) { sound_run = true; scriptt.Next(); } } }
void OnCollisionEnter(Collision col) { bool isSphere = false; if (col.collider.name == "GreenSphere") { Source.PlayOneShot(GreenSphereSound); isSphere = true; Datas.GreenBalls++; Datas.AdjustHealth(5.0f); } if (col.collider.name == "YellowSphere") { Source.PlayOneShot(YellowSphereSound); isSphere = true; Datas.YellowBalls++; GetComponentInChildren <Light>().intensity += 1.0f; GetComponentInChildren <Light>().spotAngle += 3.0f; } if (col.collider.name == "RedSphere") { Source.PlayOneShot(RedSphereSound); isSphere = true; Datas.RedBalls++; } if (isSphere) { DidactitielScript script = GameObject.Find("OnLoadPlay").GetComponent <DidactitielScript>(); if (!sound_run && script.IsStep(1)) { sound_run = true; script.Next(); } Network.Destroy(col.gameObject); } }
void OnCollisionEnter(Collision col) { bool isMorceau = false; if (col.collider.name == "morceau_cle") { DidactitielScript script = GameObject.Find("OnLoadPlay").GetComponent <DidactitielScript>(); if (!sound_run && script.IsStep(2)) { sound_run = true; script.Next(); } Source.PlayOneShot(Sound); isMorceau = true; Datas.NbCollectedFragments++; } if (isMorceau) { Network.Destroy(col.gameObject); } }