private void destroyScript() { vitals.setEnergyState(false); //deletes this game object Destroy(gameObject); print("You now have neutral energy."); }
// Use this for initialization private void Start() { //find the vitals script and sets an inital value GameObject player = GameObject.Find("Character"); vitals = player.GetComponent <Vitals>(); vitals.setEnergyState(true); //get some initial references energyOverlay = transform.Find("Fade").GetComponent <Image>(); FPPCamera = player.transform.Find("FPPCamera").GetComponent <Camera>(); playerController = player.GetComponent <PlayerController>(); //get the initial fov initialFOV = FPPCamera.fieldOfView; normalSpeed = playerController.getNormalSpeed(); sprintSpeed = playerController.getSprintSpeed(); }