/// <summary> /// Gets game object associated with the entity. /// </summary> /// <param name="id">Identifier of the entity which game object is required.</param> /// <returns><see cref="GameObject"/> for given entity.</returns> public static GameObject Get(EntityId id) { var handle = GameObjectInterop.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); }
/// <summary> /// Tries to get the extension. /// </summary> /// <param name="name">Name of the extension to attempt to acquire.</param> /// <returns> /// The extension wrapper object if successful, null if returned handle was null. /// </returns> public GameObjectExtension QueryExtension(string name) { return(this.TryGetExtension(GameObjectInterop.QueryExtension(this.Handle, name))); }
/// <summary> /// </summary> /// <param name="physicsEvent"></param> /// <returns></returns> public bool WantsPhysicsEvent(EntityPhysicsEvents physicsEvent) { return(GameObjectInterop.WantsPhysicsEvent(this.Handle, physicsEvent)); }
/// <summary> /// En/disables sending physics event to this game object. /// </summary> /// <param name="enable"> Indicates whether event must enabled or disabled.</param> /// <param name="physicsEvent"> /// <see cref="EntityPhysicsEvents"/> object that designates the event. /// </param> public void EnablePhysicsEvent(bool enable, EntityPhysicsEvents physicsEvent) { GameObjectInterop.EnablePhysicsEvent(this.Handle, enable, physicsEvent); }
public bool SetAspectProfile(EntityAspects aspect, ushort profile, bool fromNetwork = false) { return(GameObjectInterop.SetAspectProfile(this.Handle, aspect, profile, fromNetwork)); }
/// <summary> /// Binds the game object to the network. /// </summary> /// <remarks>Allows the entity to be synchronized over the network.</remarks> /// <param name="mode">Binding mode.</param> /// <returns>True, if successful.</returns> public bool BindToNetwork(BindToNetworkMode mode = BindToNetworkMode.Normal) { return(GameObjectInterop.BindToNetwork(this.Handle, mode)); }
public void NotifyNetworkStateChange(int aspect) { GameObjectInterop.ChangedNetworkState(this.Handle, aspect); }
/// <summary> /// Deactivates the extension. /// </summary> /// <param name="name">Name of the extension to deactivate.</param> public void DeactivateExtension(string name) { GameObjectInterop.DeactivateExtension(this.Handle, name); }
/// <summary> /// Activates the extension. /// </summary> /// <param name="name">Name of the extension to activate.</param> /// <returns>True, if successful.</returns> public bool ActivateExtension(string name) { return(GameObjectInterop.ActivateExtension(this.Handle, name)); }
/// <summary> /// Release a previously acquired extension /// </summary> /// <param name="name">Name of the extension.</param> public void ReleaseExtension(string name) { GameObjectInterop.ReleaseExtension(this.Handle, name); }
/// <summary> /// Forces return of a wrapper object for an extension. /// </summary> /// <remarks>New extension is instantiated if needed.</remarks> /// <param name="name">Name of the extension.</param> /// <returns>The extension wrapper object.</returns> public GameObjectExtension AcquireExtension(string name) { return(this.TryGetExtension(GameObjectInterop.AcquireExtension(this.Handle, name))); }