all repos — RPG @ 502924ae35666f2d5ac541310b3e57f2e4fe70b4

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}