Falco Engine 3.9.0.1 (beta)
GameObject.cs
Go to the documentation of this file.
1using System;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5namespace FalcoEngine
6{
7 [StructLayout(LayoutKind.Sequential)]
8 public class GameObject
9 {
10 private IntPtr this_ptr = (IntPtr)0;
11
12 /*----------- PUBLIC ------------*/
13
17 [MethodImpl(MethodImplOptions.InternalCall)]
18 public extern GameObject();
19
23 public string name { [MethodImpl(MethodImplOptions.InternalCall)] get; }
24
28 public string uniqueName { [MethodImpl(MethodImplOptions.InternalCall)] get; }
29
33 public bool enabled { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
34
38 public bool active { [MethodImpl(MethodImplOptions.InternalCall)] get; }
39
43 public string tag { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
44
48 public int layer { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }
49
53 public Transform transform { [MethodImpl(MethodImplOptions.InternalCall)] get; }
54
58 public Rigidbody rigidbody { [MethodImpl(MethodImplOptions.InternalCall)] get; }
59
63 public Animation animation { [MethodImpl(MethodImplOptions.InternalCall)] get; }
64
68 public AudioSource audioSource { [MethodImpl(MethodImplOptions.InternalCall)] get; }
69
73 public NavMeshAgent navMeshAgent { [MethodImpl(MethodImplOptions.InternalCall)] get; }
74
78 public Component[] components { [MethodImpl(MethodImplOptions.InternalCall)] get; }
79
86 {
87 return INTERNAL_get_component_t<T>(typeof(T));
88 }
89
96 {
97 return INTERNAL_add_component_t<T>(typeof(T));
98 }
99
104 [MethodImpl(MethodImplOptions.InternalCall)]
105 public extern GameObject Clone();
106
112 public static GameObject Find(string name)
113 {
114 return INTERNAL_find(name);
115 }
116
122 public static GameObject GetByUniqueName(string name)
123 {
124 return INTERNAL_getByUniqueName(name);
125 }
126
127 /*----------- INTERNAL CALLS ------------*/
128
129 [MethodImpl(MethodImplOptions.InternalCall)]
130 private static extern GameObject INTERNAL_find(string name);
131
132 [MethodImpl(MethodImplOptions.InternalCall)]
133 private static extern GameObject INTERNAL_getByUniqueName(string name);
134
135 [MethodImpl(MethodImplOptions.InternalCall)]
136 private extern T INTERNAL_get_component_t<T>(Type type);
137
138 [MethodImpl(MethodImplOptions.InternalCall)]
139 private extern T INTERNAL_add_component_t<T>(Type type);
140 }
141}
T AddComponent< T >()
Create new component of type T and attach it to this game object
Definition: GameObject.cs:95
Component[] components
Return an array of all game object's components
Definition: GameObject.cs:78
Animation animation
Animation component
Definition: GameObject.cs:63
bool enabled
Get or set game object enabled state
Definition: GameObject.cs:33
string uniqueName
Return game object unique name (UID)
Definition: GameObject.cs:28
GameObject()
Create new empty game object
AudioSource audioSource
AudioSource component
Definition: GameObject.cs:68
static GameObject GetByUniqueName(string name)
Return game object by it's unique name (UID)
Definition: GameObject.cs:122
Rigidbody rigidbody
RigidBody component
Definition: GameObject.cs:58
GameObject Clone()
Create a copy of this game object
Transform transform
Transform component
Definition: GameObject.cs:53
static GameObject Find(string name)
Find game object by name. If scene has multiple game objects with the same name, the first will be re...
Definition: GameObject.cs:112
int layer
Get or set game object layer
Definition: GameObject.cs:48
string tag
Get or set game object tag
Definition: GameObject.cs:43
bool active
Return true if game object enabled self and all of it's parents are enabled too
Definition: GameObject.cs:38
string name
Return game object name
Definition: GameObject.cs:23
NavMeshAgent navMeshAgent
NavMeshAgent component
Definition: GameObject.cs:73
T GetComponent< T >()
Return component by type
Definition: GameObject.cs:85