public DustManager(
            SunOrbit orb,
            Persistence.Game game,
            Persistence.Base @base,
            SurvivalTimer timer,
            Func <IEnumerator, Coroutine> startCoroutine,
            Action <Coroutine> stopCoroutine)
        {
            survivalTimer = timer;
            survivalTimer.OnPlayerInHabitatChange += _OnPlayerInHabitatChange;
            orb.OnSolChange      += _OnSolChange;
            orb.OnHourChange     += _OnHourChange;
            orb.OnDawn           += _OnDawn;
            orb.OnDusk           += _OnDusk;
            DuskAndDawnOnlyParent = orb.DuskAndDawnOnlyParent;
            environment           = game.Environment;
            this.random           = new System.Random(@base.WeatherSeed);
            this.startCoroutine   = startCoroutine;
            this.stopCoroutine    = stopCoroutine;
            FastForward(environment.CurrentSol);
            DoAfterSolChange();

            if (environment.CurrentHour > 12)
            {
                AnnounceForecast();
            }
            else
            {
#if UNITY_EDITOR
                AnnounceForecast();
#endif
            }
            refreshSolarPanels();
        }
Exemple #2
0
 void Awake()
 {
     Instance       = this;
     CurrentHabitat = null;
 }
Exemple #3
0
    internal void RefreshDeprivationUX(SurvivalTimer survivalTimer)
    {
        bool isPowerDeprived  = survivalTimer.Data.Power.DeprivationSeconds > 0f,
             isOxygenDeprived = survivalTimer.Data.Oxygen.DeprivationSeconds > 0f,
             isFoodDeprived   = survivalTimer.Data.Food.DeprivationSeconds > 0f,
             isWaterDeprived  = survivalTimer.Data.Water.DeprivationSeconds > 0f;

        ShowingDeprivationUX = isPowerDeprived || isOxygenDeprived || isFoodDeprived || isWaterDeprived;

        //sounds
        if (isOxygenDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.VocalSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.Gasping;
            PlayerInput.Instance.VocalSource.Play();
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowToDeathHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isPowerDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.VocalSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.Chattering;
            PlayerInput.Instance.VocalSource.Play();
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isFoodDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isWaterDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (!ShowingDeprivationUX && PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.Stop();
            PlayerInput.Instance.VocalSource.Stop();
        }

        //colorgrading
        if (isOxygenDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Oxygen.DeprivationSeconds / survivalTimer.DeprivationDurations.OxygenDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.saturation = Mathf.Min(1f, Mathf.Lerp(1f, 0f, lerpT) + .25f);
            newBasics.contrast   = Mathf.Lerp(1f, 2f, lerpT);
            newSettings.basic    = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isPowerDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Power.DeprivationSeconds / survivalTimer.DeprivationDurations.PowerDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.temperature             = Mathf.Lerp(0f, -40f, lerpT);
            newSettings.basic                 = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isWaterDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Water.DeprivationSeconds / survivalTimer.DeprivationDurations.WaterDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.temperature             = Mathf.Lerp(0f, 35f, lerpT);
            newBasics.saturation              = Mathf.Lerp(1f, 0f, lerpT);
            newSettings.basic                 = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isFoodDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.contrast   = Mathf.Lerp(1f, 1.5f, lerpT);
            newBasics.saturation = Mathf.Lerp(1f, 0f, lerpT);
            newSettings.basic    = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else
        {
            PostProfile.colorGrading.enabled = false;
        }

        //motion blur
        if (isFoodDeprived)
        {
            PostProfile.motionBlur.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;
            MotionBlurModel.Settings newSettings = MotionBlurModel.Settings.defaultSettings;
            newSettings.frameBlending       = Mathf.Lerp(1f, 0.5f, lerpT);
            newSettings.shutterAngle        = Mathf.Lerp(0f, 360f, lerpT);
            newSettings.sampleCount         = 4;
            PostProfile.motionBlur.settings = newSettings;
        }

        //depth of field
        if (isWaterDeprived)
        {
            PostProfile.depthOfField.enabled = true;
            float lerpT = survivalTimer.Data.Water.DeprivationSeconds / survivalTimer.DeprivationDurations.WaterDeprivationSurvivalTimeSeconds;
            DepthOfFieldModel.Settings newSettings = DepthOfFieldModel.Settings.defaultSettings;
            //DepthOfFieldModel.BasicSettings newBasics = DepthOfFieldModel.BasicSettings.defaultSettings;
            newSettings.aperture              = Mathf.Lerp(5f, 0.05f, lerpT);
            newSettings.useCameraFov          = true;
            newSettings.focusDistance         = 1f;
            newSettings.kernelSize            = DepthOfFieldModel.KernelSize.VeryLarge;
            PostProfile.depthOfField.settings = newSettings;
        }

        //vignetting
        if (isOxygenDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Oxygen.DeprivationSeconds;
            lerpT -= (float)Math.Truncate(lerpT);

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(51f / 255f, 51f / 255f, 51f / 255f);
            newSettings.intensity         = Mathf.PingPong(lerpT, .5f);
            newSettings.smoothness        = 1f;
            newSettings.roundness         = 1f;
            PostProfile.vignette.settings = newSettings;
        }
        else if (isPowerDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Power.DeprivationSeconds / survivalTimer.DeprivationDurations.PowerDeprivationSurvivalTimeSeconds;

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(68f / 255f, 108f / 255f, 255f / 255f);
            newSettings.intensity         = Mathf.Lerp(0f, 0.76f, lerpT);
            newSettings.smoothness        = 0.169f;
            newSettings.roundness         = 1;
            PostProfile.vignette.settings = newSettings;
        }
        else if (isFoodDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(32f / 255f, 32f / 255f, 32f / 255f);
            newSettings.intensity         = Mathf.Lerp(0f, 0.4f, lerpT);
            newSettings.smoothness        = Mathf.Lerp(0f, 0.5f, lerpT);
            newSettings.roundness         = 1;
            PostProfile.vignette.settings = newSettings;
        }
        else
        {
            PostProfile.vignette.enabled = false;
        }
    }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        audioSource = GetComponent <AudioSource>();

        rb2 = GetComponent <Rigidbody2D>();

        fixBlock = false;

        timerObject = GameObject.Find("SurvivalTime");
        timerScript = timerObject.GetComponent <SurvivalTimer>();

        // survivalCreateObject = GameObject.Find("CreateBlock");
        //survivalCreateScript = survivalCreateObject.GetComponent<SurvivalCreateBlock>();

        playerNumber    = GameObject.Find("GetPlayerNumber");
        getPlayerNumber = playerNumber.GetComponent <GetPlayerNumber>();

        //playerLife = GameObject.Find("PlayerLife");
        gameResult   = GameObject.Find("ResultManager");
        resultScript = gameResult.GetComponent <ResultProcess>();


        root = transform.root.gameObject;

        if (root == getPlayerNumber.getNumber[0])
        {
            survivalCreateObject = GameObject.Find("CreateBlock (1)");
            playerLife           = GameObject.Find("Life (1)");
            loseProcessObject    = GameObject.Find("Player1");
        }
        else if (root == getPlayerNumber.getNumber[1])
        {
            survivalCreateObject = GameObject.Find("CreateBlock (2)");
            playerLife           = GameObject.Find("Life (2)");
            loseProcessObject    = GameObject.Find("Player2");
        }
        else if (root == getPlayerNumber.getNumber[2])
        {
            survivalCreateObject = GameObject.Find("CreateBlock (3)");
            playerLife           = GameObject.Find("Life (3)");
            loseProcessObject    = GameObject.Find("Player3");
        }
        else if (root == getPlayerNumber.getNumber[3])
        {
            survivalCreateObject = GameObject.Find("CreateBlock (4)");
            playerLife           = GameObject.Find("Life (4)");
            loseProcessObject    = GameObject.Find("Player4");
        }

        survivalCreateScript = survivalCreateObject.GetComponent <SurvivalCreateBlock>();
        lifeScript           = playerLife.GetComponent <Life>();


        loseScript = loseProcessObject.GetComponent <SurvivalResult>();

        timerCheck = timerScript.TimerCount;

        survivalFall.enabled = false;
        survivalCtrl.enabled = false;

        if (timerCheck >= 0)
        {
            start = true;
        }
        else
        {
            standBy = true;
            start   = false;

            if (root == getPlayerNumber.getNumber[0])
            {
                fallBlock = GameObject.Find("FallBlock1");
            }
            else if (root == getPlayerNumber.getNumber[1])
            {
                fallBlock = GameObject.Find("FallBlock2");
            }
            else if (root == getPlayerNumber.getNumber[2])
            {
                fallBlock = GameObject.Find("FallBlock3");
            }
            else if (root == getPlayerNumber.getNumber[3])
            {
                fallBlock = GameObject.Find("FallBlock4");
            }

            survivalBlockMgr = fallBlock.GetComponent <SurvivalBlockMgr>();
        }

        blockWaiver = false;
    }
 void Awake()
 {
     instance = this;
 }