Kyle_Dev

Omnious Obstacles - PlayerController -> Player

Nov 5th, 2019
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public delegate void OnTrapHit();
  6.  
  7. public class PlayerController : MonoBehaviour
  8. {
  9.     [SerializeField]
  10.     Transform m_spawnpoint;
  11.  
  12.     void Start()
  13.     {
  14.         Reset();
  15.     }
  16.  
  17.     public void Reset()
  18.     {
  19.         transform.position = m_spawnpoint.position;
  20.     }
  21.  
  22.     public void OnTriggerEnter(Collider other)
  23.     {
  24.         if (other.CompareTag("Trap"))
  25.         {
  26.             Debug.Log("IK BEN GERAAKT!!!");
  27.             other.gameObject.GetComponentInParent<Trap>().Reset();
  28.  
  29.             Reset();
  30.         }
  31.     }
  32. }
RAW Paste Data