Example #1
0
 private void Update()
 {
     desiredValue = AtmosphereManager.GetGas(GasType).Percentage;
     currentValue = Mathf.Lerp(currentValue, desiredValue, 0.004f);
     UpdatePosition(currentValue);
 }
Example #2
0
    public void Evaluate()
    {
        string gasRating   = "Neutral";
        string musicRating = "Nuetral";
        string heatRating  = "Neutral";

        //Atmosphere
        float gasPenalty = 0f;

        foreach (var myGas in this.BreathableAtmosphere)
        {
            var cabinGas = AtmosphereManager.GetGas(myGas.Key);

            float diff = Mathf.Abs(cabinGas.Percentage - myGas.Value.Percentage);

            if (diff > breathableTolerance)
            {
                gasPenalty -= RatingPenaltyPerSecond * Time.deltaTime;
            }
            else
            {
                gasPenalty += RatingBonusPerSecond * Time.deltaTime;
            }
        }


        if (gasPenalty > 0)
        {
            gasRating = "Good Atmosphere: " + gasPenalty;
            ScoreManager.ImproveUberRating(gasPenalty);
        }
        else
        {
            gasRating = "Bad Atmosphere: " + gasPenalty;
            ScoreManager.DamageUberRating(-gasPenalty);
        }


        //Music
        if (RadioMusicManager.Instance.CurrentRadio.RadioType == HatedRadio.RadioType)
        {
            //I don't care what the volume is, turn it off mate.
            ScoreManager.DamageUberRating(RatingPenaltyPerSecond * Time.deltaTime);
            musicRating = "Hate Song";
        }

        if (RadioMusicManager.Instance.CurrentRadio.RadioType == LikedRadio.RadioType)
        {
            bool  withinTolerance = Mathf.Abs(RadioMusicManager.Instance.CurrentRadio.Volume - LikedRadio.Volume) < LikedRadio.Volume;
            float improvement     = RatingBonusPerSecond * Time.deltaTime;
            musicRating = "Like Song";

            //Too loud, or I can't here it? I don't enjoy it so much
            if (withinTolerance)
            {
                musicRating += " ,Bad Volume";
                improvement *= 0.5f;
            }

            ScoreManager.ImproveUberRating(improvement);
        }

        //Heat
        float diffDegrees = Mathf.Abs(HeatingManager.Instance.Heat.TemperatureDegrees - LikedHeat.TemperatureDegrees);

        //That's comfy
        if (diffDegrees < LikedHeat.ToleranceDegrees)
        {
            heatRating = "Good Heat";
            ScoreManager.ImproveUberRating(RatingBonusPerSecond * Time.deltaTime);
        }

        //Dude, too hot or cold.
        else
        {
            heatRating = "Bad Heat";
            ScoreManager.DamageUberRating(RatingPenaltyPerSecond * Time.deltaTime);
        }

        MyAlien.DebugUberText.text       = "Uber: " + ScoreManager.UberRating + " / 5";
        MyAlien.DebugAtmosphereText.text = "Gas: " + gasRating;
        MyAlien.DebugHeatText.text       = "Heat: " + heatRating;
        MyAlien.DebugMusicText.text      = "Music: " + musicRating;
    }