Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
 /// <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)));
 }
Esempio n. 3
0
 /// <summary>
 /// </summary>
 /// <param name="physicsEvent"></param>
 /// <returns></returns>
 public bool WantsPhysicsEvent(EntityPhysicsEvents physicsEvent)
 {
     return(GameObjectInterop.WantsPhysicsEvent(this.Handle, physicsEvent));
 }
Esempio n. 4
0
 /// <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);
 }
Esempio n. 5
0
 public bool SetAspectProfile(EntityAspects aspect, ushort profile, bool fromNetwork = false)
 {
     return(GameObjectInterop.SetAspectProfile(this.Handle, aspect, profile, fromNetwork));
 }
Esempio n. 6
0
 /// <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));
 }
Esempio n. 7
0
 public void NotifyNetworkStateChange(int aspect)
 {
     GameObjectInterop.ChangedNetworkState(this.Handle, aspect);
 }
Esempio n. 8
0
 /// <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);
 }
Esempio n. 9
0
 /// <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));
 }
Esempio n. 10
0
 /// <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);
 }
Esempio n. 11
0
 /// <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)));
 }