all repos — RPG @ 44a6fb4aa7a60749bfe9d30472e7550b824ffe51

Fully functional 3D turn based role playing game coded in C# and base Unity.

Assets/Scripts/Overworld/IsEnemyTrigger.cs (view raw)

 1using UnityEngine;
 2using UnityEngine.SceneManagement;
 3
 4[RequireComponent(typeof(Rigidbody))]
 5[RequireComponent(typeof(CapsuleCollider))]
 6public class IsEnemyTrigger : MonoBehaviour
 7{
 8    private GameMaster gm;
 9    public string EnemyType;
10
11    private void Start()
12    {
13        gm = GameMaster.Instance;
14    }
15
16    void OnTriggerEnter(Collider other)
17    {
18        if (other.gameObject.name == "Player")
19        {
20            gm.EnterBattle(transform.parent.name, EnemyType);
21        }
22            
23    }
24}