Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class GrabableLedge : MonoBehaviour
- {
- private Transform target;
- private PlayerMovement player;
- private Animator anim;
- private HashIDs hash;
- void Awake()
- {
- target = transform.FindChild("target");
- player = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<PlayerMovement>();
- anim = GameObject.FindGameObjectWithTag(Tags.player).GetComponent<Animator>();
- hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
- }
- void OnTriggerStay(Collider other)
- {
- if (other.tag == Tags.player)
- {
- player.handTarget = target;
- anim.SetBool(hash.nearLedgeBool, true);
- }
- }
- void OnTriggerExit(Collider other)
- {
- if (other.tag == Tags.player)
- {
- player.handTarget = null;
- anim.SetBool(hash.nearLedgeBool, false);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement