Example #1
0
        /// <summary>
        /// Removes an actor by channelId
        /// </summary>
        /// <param name="channelId"></param>
        public static void Remove(int channelId)
        {
            var actorInfo = NativeActorMethods.GetActorInfoByChannelId((ushort)channelId);

            if (actorInfo.Id != 0)
            {
                NativeActorMethods.RemoveActor(actorInfo.Id);
            }
        }
Example #2
0
        /// <summary>
        /// Gets the actor with the specified channel id if it exists.
        /// </summary>
        /// <param name="channelId">channelId of the actor you want to obtain</param>
        /// <returns>Actor if found, null otherwise</returns>
        public static ActorBase Get(int channelId)
        {
            var actor = Get <ActorBase>(channelId);

            if (actor != null)
            {
                return(actor);
            }

            var entityInfo = NativeActorMethods.GetActorInfoByChannelId((ushort)channelId);

            if (entityInfo.Id != 0)
            {
                return(CreateNativeActor(entityInfo));
            }

            return(null);
        }