コード例 #1
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    void Awake()
    {
        //--------------

        Class_Interface.HideLockMouse(hideLockMouse);

        if (killPlayer == true)
        {
            PlayerPrefs.SetInt("Mineral 0", 0);
        }
        if (clearPlayerPrefs == true)
        {
            PlayerPrefs.DeleteAll();
        }

        graphicsQualityButton.onClick.AddListener(_DynamicLightingButton);
        okButton.onClick.AddListener(_OkButton);
        cancelButton.onClick.AddListener(_CancelButton);
        exitButton.onClick.AddListener(_ExitButton);

        graphicsQualityText = graphicsQualityButton.GetComponent <Text>();

        if (Class_Interface.initialScreen == false)
        {
            Class_Interface.initialScreen = true;
            initialScreen.SetActive(true);
        }

        Class_StarSystem.systemSelected = false;

        CheckSettings();

        //--------------
    }
コード例 #2
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    void Awake()
    {
        //--------------

        Time.timeScale = 1;
        Class_Interface.HideLockMouse(hideLockMouse);
        Class_Interface.mouseSensitivityValue = PlayerPrefs.GetFloat("mouseSensitivityValue");
        Class_Interface.globalPausa           = Class_Interface.loading = false;
        Class_Interface.powerEnabled          = Class_Interface.defaultEnabled = Class_Interface.lightningEnabled = Class_Interface.laserEnabled = Class_Interface.pulseEnabled = false;
        Class_Interface.speedEnabled          = Class_Interface.collapsarEnabled = Class_Interface.destroyerEnabled = Class_Interface.eraserEnabled = Class_Interface.antigravityEnabled = false;
        Class_AI.amountEnemyAIs = Class_AI.amountFriendlyAIs = 0;

        inventoryScreen.SetActive(false);
        informationScreen.SetActive(false);
        playerIsDeadScreen.SetActive(false);
        friendsDestroyedScreen.SetActive(false);
        enemiesDestroyedScreen.SetActive(false);

        //--------------

        QualitySettings.lodBias     = Class_Interface.LODValue = PlayerPrefs.GetFloat("LODValue");
        Class_Interface.distanceLod = 1000 * Class_Interface.LODValue;

        float[] distancesCul = new float[32];
        distancesCul[11] = 750 * Class_Interface.LODValue;
        distancesCul[13] = distancesCul[15] = 1500 * Class_Interface.LODValue;
        distancesCul[18] = 1000 * Class_Interface.LODValue;
        distancesCul[19] = 2200 * Class_Interface.LODValue;
        distancesCul[20] = 1100 * Class_Interface.LODValue;
        distancesCul[21] = 650 * Class_Interface.LODValue;
        distancesCul[31] = 550 * Class_Interface.LODValue;
        mainCamera       = Camera.main;
        mainCamera.layerCullDistances = distancesCul;
        mainCamera.layerCullSpherical = true;

        //--------------

        if (PlayerPrefs.GetInt("GraphicsQualityLow") == 0)
        {
            mainCamera.renderingPath        = RenderingPath.DeferredShading;
            QualitySettings.pixelLightCount = 3;
            mainCamera.GetComponent <GlobalFog>().enabled = true;
            QualitySettings.shadows         = ShadowQuality.All;
            QualitySettings.shadowDistance  = 350 * Class_Interface.LODValue;
            Class_Interface.dynamicLighting = Class_Interface.shadows = true;
        }
        else
        {
            mainCamera.renderingPath        = RenderingPath.Forward;
            QualitySettings.pixelLightCount = 1;
            mainCamera.GetComponent <GlobalFog>().enabled = false;
            QualitySettings.shadows         = ShadowQuality.Disable;
            Class_Interface.dynamicLighting = Class_Interface.shadows = false;
        }

        masterMixer.SetFloat("EffectsVolume", Mathf.Log(PlayerPrefs.GetFloat("effectsVolumeValue")) * Mathf.Abs(Mathf.Log(PlayerPrefs.GetFloat("effectsVolumeValue"))) * 15);
        masterMixer.SetFloat("OSTVolume", Mathf.Log(PlayerPrefs.GetFloat("musicVolumeValue")) * 22);

        //--------------

        enabledColor      = new Color(0.65f, 0.65f, 0.65f, 1);
        disabledColor     = new Color(1, 1, 1, 1);
        notAvailableColor = new Color(1, 1, 1, 0.2f);

        powerImage       = powerButton.GetComponent <Image>();
        speedImage       = speedButton.GetComponent <Image>();
        lightningImage   = lightningButton.GetComponent <Image>();
        laserImage       = laserButton.GetComponent <Image>();
        pulseImage       = pulseButton.GetComponent <Image>();
        maskerImage      = maskerButton.GetComponent <Image>();
        antigravityImage = antigravityButton.GetComponent <Image>();
        tamingImage      = tamingButton.GetComponent <Image>();
        eraserImage      = eraserButton.GetComponent <Image>();
        collapsarImage   = collapsarButton.GetComponent <Image>();
        destroyerImage   = destroyerButton.GetComponent <Image>();

        returnToGameButton.onClick.AddListener(ReturnToGame);
        mainMenuButton.onClick.AddListener(MainMenu);
        informationYesButton.onClick.AddListener(ExitToMenu);
        informationNoButton.onClick.AddListener(ReturnToGame);

        speedIndicatorTransform.localScale = new Vector3(0.025f, 1, 1);

        //--------------

        MineralsPlayerPrefs(false);
        StartCoroutine(Autosave());
        StartCoroutine(Statistics());
        StartCoroutine(EnemyFriendlyPriority());
        StartCoroutine(Class_Interface.SubtractionMineralsOverTime());

        //--------------
    }
コード例 #3
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    void LateUpdate()
    {
        //--------------

        if (Class_Controller.playerAlive == true)
        {
            if (Class_Interface.loading == false)
            {
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    if (inventoryScreen.activeSelf == false)
                    {
                        EntranceToInventory();
                    }
                    else
                    {
                        ReturnToGame();
                    }
                }
                if (loadingRing.activeSelf == true)
                {
                    loadingRing.SetActive(false);
                }
            }
            else if (loadingRing.activeSelf == false)
            {
                loadingRing.SetActive(true);
            }

            if (Class_Controller.currentSpeed >= 1)
            {
                if (Class_Interface.speedEnabled == true)
                {
                    if (speedIndicator != 1.3f)
                    {
                        speedIndicator = 1.3f;
                    }
                }
                else
                {
                    if (speedIndicator > 1.08f)
                    {
                        speedIndicator -= 0.007f;
                    }
                    else if (speedIndicator <= 1.08f)
                    {
                        speedIndicator = 1.08f;
                    }
                }
                speedIndicatorTransform.localScale = new Vector3(Vector3.one.x * Class_Controller.currentSpeed * 0.016f, Vector3.one.y, Vector3.one.z);
                if (speedIndicatorTransform.localScale.x > speedIndicator)
                {
                    speedIndicatorTransform.localScale = new Vector3(speedIndicator, Vector3.one.y, Vector3.one.z);
                }
            }

            Inventory();
        }
        else if (playerIsDeadScreen.activeSelf == false)
        {
            PlayerPrefs.SetInt("Mineral 0", 0);
            playerIsDeadScreen.SetActive(true);
        }

        //--------------

        if (pause == false)
        {
            Class_Interface.HideLockMouse(hideLockMouse);
        }
        else
        {
            Class_Interface.HideLockMouse(false);
        }

        //--------------
    }
コード例 #4
0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    void LateUpdate()
    {
        //--------------

        if (initialScreen.activeSelf == false)
        {
            if (PlayerPrefs.GetInt("FirstStart") == 0)
            {
                firstReported.SetActive(true);
                PlayerPrefs.SetInt("FirstStart", 1);
                PlayerPrefs.SetInt("GraphicsQualityLow", 0);
                PlayerPrefs.SetFloat("LODValue", 1.0f);
                PlayerPrefs.SetFloat("mouseSensitivityValue", 1.0f);
                PlayerPrefs.SetFloat("effectsVolumeValue", 1.0f);
                PlayerPrefs.SetFloat("musicVolumeValue", 0.5f);
                GiveMinerals();
            }

            if (PlayerPrefs.GetInt("FirstStart") != 0 && PlayerPrefs.GetInt("Mineral 0") == 0 && anotherGuardReported.activeSelf == false)
            {
                anotherGuardReported.SetActive(true);
                PlayerPrefs.SetInt("SquareGuardsDied", PlayerPrefs.GetInt("SquareGuardsDied") + 1);
                squareGuardsText.text = "Square guards died : " + PlayerPrefs.GetInt("SquareGuardsDied");
                GiveMinerals();
            }

            if (escMenu.activeSelf == false && firstReported.activeSelf == false && anotherGuardReported.activeSelf == false)
            {
                if (gui.activeSelf == false)
                {
                    gui.SetActive(true);
                }
                if (Class_Interface.menuControlLock == true)
                {
                    Class_Interface.menuControlLock = false;
                }
                Class_Interface.HideLockMouse(hideLockMouse);
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    escMenu.SetActive(true);
                    CheckSettings();
                }
            }
            else if (escMenu.activeSelf == true)
            {
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    _CancelButton();
                }
                masterMixer.SetFloat("EffectsVolume", Mathf.Log(effectsVolumeSlider.value) * Mathf.Abs(Mathf.Log(effectsVolumeSlider.value)) * 15);
                masterMixer.SetFloat("OSTVolume", Mathf.Log(musicVolumeSlider.value) * 22);
            }
        }

        if (initialScreen.activeSelf == true || escMenu.activeSelf == true || firstReported.activeSelf == true || anotherGuardReported.activeSelf == true)
        {
            if (gui.activeSelf == true)
            {
                gui.SetActive(false);
            }
            if (Class_Interface.menuControlLock == false)
            {
                Class_Interface.menuControlLock = true;
            }
            if (escMenu.activeSelf == true || firstReported.activeSelf == true || anotherGuardReported.activeSelf == true)
            {
                Class_Interface.HideLockMouse(false);
            }
        }

        //--------------
    }