예제 #1
0
        public static IVariableCreator CreateIdentityVariables(this NetworkHandlerSystem nhs, IMyPlayer player)
        {
            if (player == null)
            {
                throw new Exception(nameof(player));
            }
            return(new EntityVariableCreator(nhs, player.IdentityId));

            //TODO: clear when identity destroyed
        }
예제 #2
0
        public static IVariableCreator CreateEntityVariables(this NetworkHandlerSystem nhs, IMyEntity entity)
        {
            if (entity == null)
            {
                throw new Exception(nameof(entity));
            }
            var res = new EntityVariableCreator(nhs, entity.EntityId);

            entity.OnClose += res.OnEntityClose;
            return(res);
        }
예제 #3
0
 public EntityVariableCreator(NetworkHandlerSystem nhs, long entityId)
 {
     if (nhs != null)
     {
         this.nhs = nhs;
     }
     else
     {
         throw new Exception(nameof(nhs));
     }
     this.entityId = entityId;
 }
예제 #4
0
 public static IVariableCreator CreateGlobalVariables(this NetworkHandlerSystem nhs)
 {
     return(new EntityVariableCreator(nhs, 0));
 }