private void Update() { if (Input.GetKeyDown(KeyCode.R)) { Application.LoadLevel(0); } if (isBroken) { _road.GetComponent <Road>()._roadSpeed = 0; _camera.GetComponent <Animator>().SetBool("broken", true); RunningCharacter.SetActive(false); BrokenCharacter.SetActive(true); RepairButton.SetActive(true); GetComponent <Control>().enabled = false; } else { _road.GetComponent <Road>()._roadSpeed = -10; _camera.GetComponent <Animator>().SetBool("broken", false); RunningCharacter.SetActive(true); BrokenCharacter.SetActive(false); RepairButton.SetActive(false); _camera.GetComponent <Animator>().enabled = true; _camera.GetComponent <ThirdPersonCamera>().enabled = false; GetComponent <Control>().enabled = true; } if (isRepair) { RepairButton.SetActive(false); } if (Input.GetKeyDown(KeyCode.L)) { TimerEndFunction(); } if (refresh) { RandomForce(); //body.GetComponent<Rigidbody>().AddForce(x, y, z); Head_r.GetComponent <Rigidbody>().AddForce(x, y, z); LeftArm_r.GetComponent <Rigidbody>().AddForce(x, y, z); RightArm_r.GetComponent <Rigidbody>().AddForce(x, y, z); LeftLeg_r.GetComponent <Rigidbody>().AddForce(x, y, z); LeftLeg_2_r.GetComponent <Rigidbody>().AddForce(x, y, z); RightLeg_r.GetComponent <Rigidbody>().AddForce(x, y, z); RightLeg_2_r.GetComponent <Rigidbody>().AddForce(x, y, z); LeftFoot_r.GetComponent <Rigidbody>().AddForce(x, y, z); RightFoot_r.GetComponent <Rigidbody>().AddForce(x, y, z); refresh = false; } if (isGameOver) { _camera.GetComponent <Animator>().SetBool("broken", false); _camera.GetComponent <Animator>().enabled = true; _camera.GetComponent <ThirdPersonCamera>().enabled = false; } }
public void TimerEndFunction() { RepairTimeIsEnd(); isBroken = false; isRepair = false; body.GetComponent <Rigidbody>().isKinematic = false; Head_r.GetComponent <Rigidbody>().isKinematic = false; LeftArm_r.GetComponent <Rigidbody>().isKinematic = false; RightArm_r.GetComponent <Rigidbody>().isKinematic = false; LeftLeg_r.GetComponent <Rigidbody>().isKinematic = false; LeftLeg_2_r.GetComponent <Rigidbody>().isKinematic = false; RightLeg_r.GetComponent <Rigidbody>().isKinematic = false; RightLeg_2_r.GetComponent <Rigidbody>().isKinematic = false; LeftFoot_r.GetComponent <Rigidbody>().isKinematic = false; RightFoot_r.GetComponent <Rigidbody>().isKinematic = false; _Head = false; _LeftArm = false; _RightArm = false; _LeftLeg = false; _LeftLeg_2 = false; _RightLeg = false; _RightLeg_2 = false; _RightFoot = false; _LeftFoot = false; if (_Head == true && _LeftArm == false && _RightArm == false && _LeftLeg == false && _LeftLeg_2 == false && _RightLeg == false && _RightLeg_2 == false && _LeftFoot == false && _RightFoot == false) { //isGameOver = true; } if (_Head == false && _LeftArm == false && _RightArm == false && _LeftLeg == false && _LeftLeg_2 == false && _RightLeg == false && _RightLeg_2 == false && _LeftFoot == false && _RightFoot == false) { //isGameOver = true; } }