Nextrek
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
*
* Adventure Creator
* by Chris Burton, 2013-2014
*
* "Trigger.cs"
*
* This ActionList runs when the Player enters it.
*
*/
using UnityEngine;
using System.Collections;
using AC;
[System.Serializable]
public class AC_Trigger : ActionList
{
public int triggerType;
public bool showInEditor = false;
private void OnTriggerEnter (Collider other)
{
if (other.CompareTag (Tags.player) && stateHandler && stateHandler.gameState == GameState.Normal && triggerType == 0)
{
Interact ();
}
}
private void OnTriggerStay (Collider other)
{
if (other.CompareTag (Tags.player) && stateHandler && stateHandler.gameState == GameState.Normal && triggerType == 1)
{
Interact ();
}
}
private void OnTriggerExit (Collider other)
{
if (other.CompareTag (Tags.player) && stateHandler && stateHandler.gameState == GameState.Normal && triggerType == 2)
{
Interact ();
}
}
private void TurnOn ()
{
if (collider)
{
collider.enabled = true;
}
else
{
Debug.LogWarning ("Cannot turn " + this.name + " on because it has no collider component.");
}
}
private void TurnOff ()
{
if (collider)
{
collider.enabled = false;
}
else
{
Debug.LogWarning ("Cannot turn " + this.name + " off because it has no collider component.");
}
}
private void OnDrawGizmos ()
{
if (showInEditor)
{
DrawGizmos ();
}
}
private void OnDrawGizmosSelected ()
{
DrawGizmos ();
}
private void DrawGizmos ()
{
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.color = new Color (1f, 0.3f, 0f, 0.8f);
Gizmos.DrawCube (Vector3.zero, Vector3.one);
}
}
|
Revision |
Author |
Commited |
Message |
83
|
FMMortaroli
|
Tue 13 May, 2014 11:32:51 +0000 |
|