Falco Engine 3.9.0.1 (beta)
MonoBehaviour.cs
Go to the documentation of this file.
1
2/*-------------------------------*/
3/*-------------------------------*/
4/*------Falco Engine C# API------*/
5/*-------------------------------*/
6/*-------------------------------*/
7/*-------Author: tracer0707------*/
8/*------------2018-2019----------*/
9/*-------------------------------*/
10/*-------------------------------*/
11
12using System;
13using System.Runtime.CompilerServices;
14using System.Runtime.InteropServices;
15
16namespace FalcoEngine
17{
18 public abstract class MonoBehaviour : Component
19 {
20 /*------------PUBLIC FIELDS------------*/
21 /*-------------------------------------*/
22 protected MonoBehaviour()
23 {
24
25 }
26
30 public string name { [MethodImpl(MethodImplOptions.InternalCall)] get; }
31
35 public string uniqueName { [MethodImpl(MethodImplOptions.InternalCall)] get; }
36
40 public Transform transform { [MethodImpl(MethodImplOptions.InternalCall)] get; }
41
45 public Rigidbody rigidbody { [MethodImpl(MethodImplOptions.InternalCall)] get; }
46
50 public Animation animation { [MethodImpl(MethodImplOptions.InternalCall)] get; }
51
55 public AudioSource audioSource { [MethodImpl(MethodImplOptions.InternalCall)] get; }
56
60 public NavMeshAgent navMeshAgent { [MethodImpl(MethodImplOptions.InternalCall)] get; }
61
65 public Component[] components { [MethodImpl(MethodImplOptions.InternalCall)] get; }
66
73 {
74 return INTERNAL_get_component_t<T>(typeof(T));
75 }
76
82 public static T FindObjectOfType<T>(bool findInactive = true)
83 {
84 return INTERNAL_find_object_of_type_t<T>(typeof(T), findInactive);
85 }
86
92 public static T[] FindObjectsOfType<T>(bool findInactive = true)
93 {
94 return INTERNAL_find_objects_of_type_t<T>(typeof(T), findInactive);
95 }
96
102 {
103 INTERNAL_destroy_game_object(gameObject);
104 }
105
110 public void Destroy(Component component)
111 {
112 INTERNAL_destroy_component(component);
113 }
114
115 /*-----------INTERNAL CALLS------------*/
116 /*-------------------------------------*/
117
118 [MethodImpl(MethodImplOptions.InternalCall)]
119 private extern T INTERNAL_get_component_t<T>(Type type);
120
121 [MethodImpl(MethodImplOptions.InternalCall)]
122 private static extern T INTERNAL_find_object_of_type_t<T>(Type type, bool findInactive);
123
124 [MethodImpl(MethodImplOptions.InternalCall)]
125 private static extern T[] INTERNAL_find_objects_of_type_t<T>(Type type, bool findInactive);
126
127 [MethodImpl(MethodImplOptions.InternalCall)]
128 private extern void INTERNAL_destroy_game_object(GameObject gameObject);
129
130 [MethodImpl(MethodImplOptions.InternalCall)]
131 private extern void INTERNAL_destroy_component(Component component);
132 }
133}
GameObject gameObject
Get game object at which this component is attached
Definition: Component.cs:26
NavMeshAgent navMeshAgent
NavMeshAgent component
AudioSource audioSource
AudioSource component
Transform transform
Transform component
static T FindObjectOfType< T >(bool findInactive=true)
Find object of type
static T[] FindObjectsOfType< T >(bool findInactive=true)
Find objects of type
Component[] components
Return an array of all game object's components
void Destroy(GameObject gameObject)
Destroy game object
string name
Game object's name
void Destroy(Component component)
Destroy component
Animation animation
Animation component
Rigidbody rigidbody
Rigidbody component
string uniqueName
Game object's unique name (UID)
T GetComponent< T >()
Return component by type