Advertisement
ZeronSix

Untitled

Jul 14th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class GrabableLedge : MonoBehaviour
  5. {
  6.     private Transform target;
  7.     private PlayerMovement player;
  8.     private Animator anim;
  9.     private HashIDs hash;
  10.  
  11.     void Awake()
  12.     {
  13.         target = transform.FindChild("target");
  14.         player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<PlayerMovement>();
  15.         anim = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<Animator>();
  16.         hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
  17.     }
  18.  
  19.     void OnTriggerStay(Collider other)
  20.     {
  21.         if (other.tag == Tags.player)
  22.         {
  23.             player.handTarget = target;
  24.             anim.SetBool(hash.nearLedgeBool, true);
  25.         }
  26.     }
  27.  
  28.     void OnTriggerExit(Collider other)
  29.     {
  30.         if (other.tag == Tags.player)
  31.         {
  32.             player.handTarget = null;
  33.             anim.SetBool(hash.nearLedgeBool, false);
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement