示例#1
0
    public void Start()
    {
        Application.RegisterLogCallback(HandleLog);

        MeshUtils.InitStaticValues();
        CubeWorldPlayerPreferences.LoadPreferences();
        PreferencesUpdated();

        State = state = GameManagerUnityState.MAIN_MENU;
        mainMenu = new MainMenu(this);

		sectorManagerUnity = new SectorManagerUnity(this);
		objectsManagerUnity = new CWObjectsManagerUnity(this);
        fxManagerUnity = new CWFxManagerUnity(this);

        worldManagerUnity = new WorldManagerUnity(this);
	}
示例#2
0
    public void Start()
    {
        Application.RegisterLogCallback(HandleLog);

        MeshUtils.InitStaticValues();
        CubeWorldPlayerPreferences.LoadPreferences();
        PreferencesUpdated();

        State    = state = GameManagerUnityState.MAIN_MENU;
        mainMenu = new MainMenu(this);

        sectorManagerUnity  = new SectorManagerUnity(this);
        objectsManagerUnity = new CWObjectsManagerUnity(this);
        fxManagerUnity      = new CWFxManagerUnity(this);

        worldManagerUnity = new WorldManagerUnity(this);
    }
示例#3
0
    public void Update()
    {
        if (registerInWebServer)
        {
            RegisterInWebServer();
        }

        switch (state)
        {
        case GameManagerUnityState.GENERATING:
        {
            if (worldManagerUnity.worldGeneratorProcess != null && worldManagerUnity.worldGeneratorProcess.IsFinished() == false)
            {
                worldManagerUnity.worldGeneratorProcess.Generate();
            }
            else
            {
                worldManagerUnity.worldGeneratorProcess = null;

                PreferencesUpdated();

                StartGame();
            }

            break;
        }

        case GameManagerUnityState.PAUSE:
        case GameManagerUnityState.GAME:
        {
            if (world != null)
            {
                surroundingsUnity.UpdateSkyColor();
                playerUnity.UpdateControlled();
                world.Update(Time.deltaTime);
                UpdateAnimatedTexture();
            }
            break;
        }
        }

        if (newState != state)
        {
            state = newState;
        }
    }
示例#4
0
    public void Unpause()
    {
        LockCursor();

        State = GameManagerUnityState.GAME;
    }
示例#5
0
    public void Pause()
    {
        ReleaseCursor();

        State = GameManagerUnityState.PAUSE;
    }
示例#6
0
    public void Update()
    {
#if !UNITY_WEBPLAYER
        if (registerInWebServer)
            RegisterInWebServer();
#endif

        switch (state)
        {
            case GameManagerUnityState.GENERATING:
            {
                if (worldManagerUnity.worldGeneratorProcess != null && worldManagerUnity.worldGeneratorProcess.IsFinished() == false)
                {
                    worldManagerUnity.worldGeneratorProcess.Generate();
                }
                else
                {
                    worldManagerUnity.worldGeneratorProcess = null;
				
                    PreferencesUpdated();

                    StartGame();
                }

                break;
            }

            case GameManagerUnityState.PAUSE:
            case GameManagerUnityState.GAME:
            {
                if (world != null)
                {
                    surroundingsUnity.UpdateSkyColor();
                    playerUnity.UpdateControlled();
                    world.Update(Time.deltaTime);
                    UpdateAnimatedTexture();
                }
                break;
            }
        }

        if (newState != state)
            state = newState;
    }
示例#7
0
    public void ReturnToMainMenu()
    {
        DestroyWorld();

        camera.enabled = true;

        State = GameManagerUnityState.MAIN_MENU;
    }
示例#8
0
    public void Unpause()
    {
        LockCursor();

        State = GameManagerUnityState.GAME;
    }
示例#9
0
    public void Pause()
    {
        ReleaseCursor();

        State = GameManagerUnityState.PAUSE;
    }
示例#10
0
    public void StartGame()
    {
        camera.enabled = false;

        LockCursor();

        State = GameManagerUnityState.GAME;
    }