Advertisement
Guest User

Interaction Handler - Custom Script using Cinput

a guest
Jul 5th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. [RequireComponent(typeof(vp_FPController))]
  2. public class C_InteractionHandler : MonoBehaviour
  3. {
  4.     public const string IGO_TAG = "IGO";
  5.     public const string WATER_ZONE = "Water";
  6.     public const string SWIM_STATE = "Swim";
  7.     public const string DEFAULT_STATE = "Default";
  8.  
  9.     public string InteractionKey;
  10.  
  11.     [Space(10)]
  12.     public List<string> InteractableTags;
  13.  
  14.     [Space(10)]
  15.     [Header("Interaction Types")]
  16.     public bool Input;
  17.     public bool Trigger;
  18.     public bool Collision;
  19.    
  20.     private vp_FPController fpsController;
  21.     private vp_FPCamera fpsCamera;
  22.     private IGO interObject;
  23.  
  24.     void Start()
  25.     {
  26.         fpsCamera = GetComponentInChildren<vp_FPCamera>();
  27.         fpsController = GetComponent<vp_FPController>();
  28.     }
  29.  
  30.     void Update()
  31.     {
  32.         if (Input && cInput.GetKeyDown("Interact"))
  33.         {
  34.             Debug.Log("Input type");
  35.             if (interObject != null)
  36.             {
  37.                 interObject.Interact();
  38.             }
  39.         }
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement