Kyle_Dev

Omnious Obstacles - PlayerController -> Player

Nov 5th, 2019 (edited)
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. //This was made in 2017
  2.  
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6.  
  7. public delegate void OnTrapHit();
  8.  
  9. public class PlayerController : MonoBehaviour
  10. {
  11.     [SerializeField]
  12.     Transform m_spawnpoint;
  13.  
  14.     void Start()
  15.     {
  16.         Reset();
  17.     }
  18.  
  19.     public void Reset()
  20.     {
  21.         transform.position = m_spawnpoint.position;
  22.     }
  23.  
  24.     public void OnTriggerEnter(Collider other)
  25.     {
  26.         if (other.CompareTag("Trap"))
  27.         {
  28.             Debug.Log("IK BEN GERAAKT!!!");
  29.             other.gameObject.GetComponentInParent<Trap>().Reset();
  30.  
  31.             Reset();
  32.         }
  33.     }
  34. }
Add Comment
Please, Sign In to add comment