-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScript.cs
115 lines (96 loc) · 3 KB
/
Script.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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using UnityEngine;
namespace Assets.Scripts
{
/// <summary>
/// Wrapper for MonoBehaviour
/// </summary>
public abstract class Script : MonoBehaviour, IDisposable
{
#region MonoBehaviour Messages
/// <summary>
/// Awake is called when the script instance is being loaded.
/// </summary>
protected virtual void Awake()
{
}
/// <summary>
/// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
/// </summary>
protected virtual void Start()
{
}
/// <summary>
/// Update is called every frame, if the MonoBehaviour is enabled.
/// </summary>
protected virtual void Update()
{
}
/// <summary>
/// This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
/// </summary>
protected virtual void FixedUpdate()
{
}
/// <summary>
/// OnBecameInvisible is called when the renderer is no longer visible by any camera.
/// </summary>
protected virtual void OnBecameInvisible()
{
}
/// <summary>
/// This function is called when the MonoBehaviour will be destroyed.
/// </summary>
protected virtual void OnDestroy()
{
}
/// <summary>
/// This function is called when the behaviour becomes disabled () or inactive.
/// </summary>
protected virtual void OnDisable()
{
}
/// <summary>
/// This function is called when the object becomes enabled and active.
/// </summary>
protected virtual void OnEnable()
{
}
/// <summary>
/// Sent when an incoming collider makes contact with this object's collider (2D physics only).
/// </summary>
protected virtual void OnCollisionEnter2D(Collision2D collision)
{
}
/// <summary>
/// Sent when another object enters a trigger collider attached to this object (2D physics only).
/// </summary>
protected virtual void OnTriggerEnter2D(Collider2D triggerCollider)
{
}
/// <summary>
/// Sent when another object leaves a trigger collider attached to this object (2D physics only).
/// </summary>
protected virtual void OnTriggerExit2D(Collider2D triggerCollider)
{
}
#endregion
#region IDisposable
protected bool IsDisposed { get; set; }
public void Dispose()
{
Dispose(true);
//GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing, float delay = 0.0f)
{
if (IsDisposed) return;
IsDisposed = true;
if (disposing)
{
Destroy(gameObject, delay);
}
}
#endregion
}
}