Beispiel #1
0
    // Update is called once per frame
    override protected void UpdateMe()
    {
        if (isPowered)
        {
            Increase();
        }
        else
        {
            Decrease();
        }

        if (currentParameter < deathTemperature && (!dialogue.hasWon))
        {
            deathTimer += Time.deltaTime;
            float deathPercentage = deathTimer / timeBetweenDeaths;
            if (nextDeadStatusLights)
            {
                if (deathPercentage > 0.5f)
                {
                    nextDeadStatusLights.SetStatus(2);
                }
                else if (deathPercentage > 0f)
                {
                    nextDeadStatusLights.SetStatus(1);
                }
            }
            if (deathTimer > timeBetweenDeaths)
            {
                if (nextDeadStatusLights != null)
                {
                    nextDeadStatusLights.SetStatus(3);
                }

                deathTimer   = 0;
                aliveHumans -= 1;
                nextDead++;
                if (nextDead < cryoBeds.Count)
                {
                    nextDeadStatusLights = cryoBeds[nextDead].GetComponent <StatusLights>();
                    OnDeadDude.Invoke();
                }
                else if (nextDead == cryoBeds.Count)
                {
                    // last one just died
                    OnDeadDude.Invoke();
                    nextDeadStatusLights = null;
                }
                else
                {
                }

                //Debug.Log("A hummie died");
            }
        }
    }
Beispiel #2
0
    override protected void StartMe()
    {
        // Shuffle order of beds
        for (int i = 0; i < cryoBeds.Count; i++)
        {
            GameObject temp        = cryoBeds[i];
            int        randomIndex = Random.Range(i, cryoBeds.Count);
            cryoBeds[i]           = cryoBeds[randomIndex];
            cryoBeds[randomIndex] = temp;
        }

        startingHumans = cryoBeds.Count;

        aliveHumans = startingHumans;

        nextDeadStatusLights = cryoBeds[nextDead].GetComponent <StatusLights>();
    }