RecoilTest.cs 543 B

123456789101112131415161718192021222324252627282930
  1. using UnityEngine;
  2. using System.Collections;
  3. using RootMotion.FinalIK;
  4. namespace RootMotion.Demos {
  5. /// <summary>
  6. /// Just for testing out the Recoil script.
  7. /// </summary>
  8. public class RecoilTest : MonoBehaviour {
  9. public float magnitude = 1f;
  10. private Recoil recoil;
  11. void Start() {
  12. recoil = GetComponent<Recoil>();
  13. }
  14. void Update() {
  15. if (Input.GetKeyDown(KeyCode.R) || Input.GetMouseButtonDown(0)) recoil.Fire(magnitude);
  16. }
  17. void OnGUI() {
  18. GUILayout.Label("Press R or LMB for procedural recoil.");
  19. }
  20. }
  21. }