Repository navigation
Expand file tree
/
Copy pathMonoBehaviour.cs
More file actions
52 lines (47 loc) · 1.58 KB
/
Copy pathMonoBehaviour.cs
File metadata and controls
52 lines (47 loc) · 1.58 KB
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
// -----------------------------------------------------------------
// File: MonoBehaviour
// Author: ruanban
// Date: 1/4/2018 4:58:58 PM
// Description:
//
// -----------------------------------------------------------------
using System.Collections;
using System.Reflection;
namespace UnityEngine
{
public class MonoBehaviour : Behaviour
{
internal override void SendMessage(string methodName)
{
if (methodName == UnityMessage.Awake)
{
if (this.componentState > CompnentState.UnAwake) return;
this.componentState = CompnentState.Awake;
}
else if (methodName == UnityMessage.Start)
{
if (this.componentState > CompnentState.Awake) return;
this.componentState = CompnentState.Start;
}
base.SendMessage(methodName);
if (methodName == UnityMessage.OnDestroy || this.enabled)
{
var method = this.GetType().GetMethod(methodName,
BindingFlags.Instance |
BindingFlags.InvokeMethod |
BindingFlags.NonPublic |
BindingFlags.Public);
if (method != null)
method.Invoke(this, null);
}
}
public Coroutine StartCoroutine(IEnumerator em)
{
return CoroutineManager.Instance.StartCoroutine(em);
}
public void StopCoroutine(Coroutine co)
{
CoroutineManager.Instance.StopCoroutine(co);
}
}
}