-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGetLightRange.cs
49 lines (43 loc) · 956 Bytes
/
GetLightRange.cs
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
// (c) Copyright HutongGames, LLC 2010-2015. All rights reserved.
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/
// Keywords: light range get
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Lights)]
[Tooltip("Gets the Range of a Light.")]
public class GetLightRange : ComponentAction<Light>
{
[RequiredField]
[CheckForComponent(typeof(Light))]
public FsmOwnerDefault gameObject;
public FsmFloat lightRange;
public bool everyFrame;
public override void Reset()
{
gameObject = null;
lightRange = 20f;
everyFrame = false;
}
public override void OnEnter()
{
DoGetLightRange();
if (!everyFrame)
{
Finish();
}
}
public override void OnUpdate()
{
DoGetLightRange();
}
void DoGetLightRange()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (UpdateCache(go))
{
lightRange.Value = light.range;
}
}
}
}