void Update() { //Debug.Log("start"); if (m_Pressed) { Debug.Log(charge_time); charge_time += Time.deltaTime; charge_time = charge_time % duration_time; chargebar.fillAmount = charge_time / duration_time; } if (m_Released) { var temp = forward.position; temp.y = 0.1f; Vector3 rot = capsuleController.getroation().eulerAngles; rot = new Vector3(rot.x, rot.y + 180, rot.z); GameObject tower = Instantiate(hooktower, temp, Quaternion.Euler(rot)); tower.GetComponent <FireHook>().hookspeed += tower.GetComponent <FireHook>().hookspeed *(charge_time / duration_time) * 3; tower.transform.Find("Hook").GetComponent <Transform>().localScale *= ((charge_time / duration_time) * 2); Debug.Log("niu"); charge_time = 0; m_Pressed = false; m_Released = false; } }