Example #1
0
 private void Awake()
 {
     //Singleton
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #2
0
        public override void Dispose( )
        {
            if (SandboxGameAssemblyWrapper.IsDebugging)
            {
                LogManager.APILog.WriteLine("Disposing CubeGridEntity '" + Name + "' ...");
            }

            //Dispose the cube grid by disposing all of the blocks
            //This may be slow but it's reliable ... so far

            /*
             * List<CubeBlockEntity> blocks = CubeBlocks;
             * int blockCount = blocks.Count;
             * foreach (CubeBlockEntity cubeBlock in blocks)
             * {
             *      cubeBlock.Dispose();
             * }
             *
             * if (SandboxGameAssemblyWrapper.IsDebugging)
             *      LogManager.APILog.WriteLine("Disposed " + blockCount.ToString() + " blocks on CubeGridEntity '" + Name + "'");
             */
            //Broadcast the removal to the clients just to save processing time for the clients
            BaseNetworkManager.RemoveEntity( );

            m_isDisposed = true;

            if (EntityId != 0)
            {
                GameEntityManager.RemoveEntity(EntityId);
            }

            EntityEventManager.EntityEvent newEvent = new EntityEventManager.EntityEvent
            {
                type      = EntityEventManager.EntityEventType.OnCubeGridDeleted,
                timestamp = DateTime.Now,
                entity    = this,
                priority  = 1
            };
            EntityEventManager.Instance.AddEvent(newEvent);
        }
Example #3
0
    private void Start()
    {
        baseNetworkManager = GameObject.FindWithTag("BaseNetworkManager").GetComponent <BaseNetworkManager>();

        //AuthTest();
    }
Example #4
0
 public BaseNetworkManager()
 {
     instance = null;
     host     = "localhost";
     port     = "12345";
 }