Ejemplo n.º 1
0
    public void Start()
    {
        //provider = new FileDatabase();
        //provider = new MysqlDatabase.Database();
        provider = new Unturned.RemoteDatabase();
        provider.Init();


        connectionGuard = new GameObject();
        UnityEngine.Object.DontDestroyOnLoad(Database.connectionGuard);
        connectionGuard.name = "Connection Guard";
        connectionGuard.AddComponent <ConnectionGuard>();

        if (!Database.welcomed)
        {
            StartCoroutine(fixFrameRate());
            Database.welcomed = true;

            PlayerSettings.id     = "Server";
            PlayerSettings.status = 21;
            if (Epoch.serverTime == -1)
            {
                Epoch.serverTime = (int)(GetServerTime() - 1401854099);
            }

            ServerSettings.cycle  = (int)(GetServerTime() - 1401854099);
            ServerSettings.offset = 0f;
            ServerSettings.time   = (int)((float)ServerSettings.cycle % Sun.COURSE);
            Sun.tick     = 0f;
            Sun.lastTick = Time.realtimeSinceStartup;
            Sun.tool.cycle();
        }
    }