private void Update() { if (Input.GetButton("Fire1")) { if (timeStamps[0] <= Time.fixedTime) { Vector3 fire1Dir = CalculateShotDirection(); timeStamps[0] = Time.fixedTime + skillsCooldown[0]; // tempo de agora + cooldown ClientSend.PlayerShoot(fire1Dir); } } if (Input.GetButtonDown("Fire2") && Client.instance.myId == 1) { if (timeStamps[1] <= Time.fixedTime) { timeStamps[1] = Time.fixedTime + skillsCooldown[1]; // tempo de agora + cooldown Vector3 fire2Dir = CalculateShotDirection(); ClientSend.PlayerShootSkill(fire2Dir); } } // tank pressiona if (Input.GetButtonDown("Fire2") && Client.instance.myId == 2) { pressedTime = Time.time; } if (Input.GetButtonUp("Fire2") && Client.instance.myId == 2) { if (timeStamps[1] <= Time.fixedTime) { timeStamps[1] = Time.fixedTime + skillsCooldown[1]; // tempo de agora + cooldown Vector3 fire2Dir = CalculateShotDirection(); ClientSend.PlayerTankSkill(fire2Dir, Time.time - pressedTime); } pressedTime = 0f; } // só aceita se tiver mostrando os botões (dentro da área) if (Input.GetButton("Jump") && showCombine) { if (timeStamps[4] <= Time.fixedTime && !waitingCombine) { ClientSend.AskCombine(this); } } }