blob: 944dc62cca57ff07bf126535bf958e69c135a5f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
using UnityEngine;
using System.Collections;
public class Enemy3TriggerScript : MonoBehaviour {
Enemy3AttackScript attack;
Enemy3FireScript fire;
void Start()
{
attack = GetComponentInChildren<Enemy3AttackScript>();
fire = GetComponentInChildren<Enemy3FireScript>();
}
void Update()
{
}
void OnTriggerStay2D(Collider2D col)
{
if (col.tag == "PlayerCollider")
{
fire.PlayerInRange = attack.PlayerInRange = true;
}
}
void OnTriggerExit2D(Collider2D col)
{
if (col.tag == "PlayerCollider")
{
fire.PlayerInRange = attack.PlayerInRange = false;
}
}
}
|