public void Update() { if (Application.isPlaying == true && GUIUtility.hotControl == 0) { if (SGT_Input.GetKey((KeyCode)rotationRequires, 1) == true) { var x = SGT_Input.DragY * -rotationSpeed; var y = SGT_Input.DragX * rotationSpeed; targetRotation *= Quaternion.Euler(x, y, 0.0f); } } var currentRotation = transform.localRotation; if (Application.isPlaying == true) { var dampenFactor = SGT_Helper.DampenFactor(rotationDampening, Time.deltaTime); currentRotation = Quaternion.Slerp(currentRotation, targetRotation, dampenFactor); } else { currentRotation = targetRotation; } SGT_Helper.SetLocalRotation(transform, currentRotation); }
public void Update() { if (shootObject != null) { if (Application.isPlaying == true && GUIUtility.hotControl == 0) { if (SGT_Input.GetKeyDown((KeyCode)shootRequires, 1) == true) { var bullet = (GameObject)Instantiate(shootObject, transform.position, transform.rotation); if (bullet.GetComponent <Rigidbody>() != null) { bullet.GetComponent <Rigidbody>().velocity = transform.forward * shootSpeed; } } } } }