Exemple #1
0
        public static GameObject Get(EntityId id)
        {
            var handle = NativeGameObjectMethods.GetGameObject(id);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            var gameObject = GameObjects.FirstOrDefault(x => x.Handle == handle);

            if (gameObject == null)
            {
                gameObject = new GameObject(handle);

                GameObjects.Add(gameObject);
            }

            return(gameObject);
        }
Exemple #2
0
 /// <summary>
 /// Release a previously acquired extension
 /// </summary>
 /// <param name="name"></param>
 public void ReleaseExtension(string name)
 {
     NativeGameObjectMethods.ReleaseExtension(Handle, name);
 }
Exemple #3
0
 /// <summary>
 /// Forcefully get a pointer to an extension (may instantiate if needed)
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public GameObjectExtension AcquireExtension(string name)
 {
     return(TryGetExtension(NativeGameObjectMethods.AcquireExtension(Handle, name)));
 }
Exemple #4
0
 /// <summary>
 /// Query extension. returns 0 if extension is not there.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public GameObjectExtension QueryExtension(string name)
 {
     return(TryGetExtension(NativeGameObjectMethods.QueryExtension(Handle, name)));
 }
Exemple #5
0
 public bool WantsPhysicsEvent(EntityPhysicsEvents physicsEvent)
 {
     return(NativeGameObjectMethods.WantsPhysicsEvent(Handle, physicsEvent));
 }
Exemple #6
0
 public void EnablePhysicsEvent(bool enable, EntityPhysicsEvents physicsEvent)
 {
     NativeGameObjectMethods.EnablePhysicsEvent(Handle, enable, physicsEvent);
 }
Exemple #7
0
 public bool SetAspectProfile(EntityAspects aspect, ushort profile, bool fromNetwork = false)
 {
     return(NativeGameObjectMethods.SetAspectProfile(Handle, aspect, profile, fromNetwork));
 }
Exemple #8
0
 public bool BindToNetwork(BindToNetworkMode mode = BindToNetworkMode.Normal)
 {
     return(NativeGameObjectMethods.BindToNetwork(Handle, mode));
 }
Exemple #9
0
 public void NotifyNetworkStateChange(int aspect)
 {
     NativeGameObjectMethods.ChangedNetworkState(Handle, aspect);
 }
Exemple #10
0
 /// <summary>
 /// Turn an extension off
 /// </summary>
 /// <param name="name"></param>
 public void DeactivateExtension(string name)
 {
     NativeGameObjectMethods.DeactivateExtension(Handle, name);
 }
Exemple #11
0
 /// <summary>
 /// Turn an extension on
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public bool ActivateExtension(string name)
 {
     return(NativeGameObjectMethods.ActivateExtension(Handle, name));
 }