示例#1
0
    // Update is called once per frame
    new void Update()

    {
        Duration += Time.deltaTime;

        if (this.NPeopleInvolved <= 0 && this.DevastationLife <= 0 && this.NAmbulances == 0 && this.NFiretrucks == 0)
        {
            //Destroy(this.gameObject);
        }

        else
        {
            if (this.NAmbulances == 0 && this.NPeopleInvolved >= 1)
            {
                this.NAmbulances = -1;
                MyArea.ReOpenMedicalEmergency(this);
            }

            if (this.NFiretrucks == 0 && this.DevastationLife >= 1)
            {
                this.NFiretrucks = -1;
                MyArea.ReOpenDisasterEmergency(this);
            }

            if (this.NPeopleInvolved >= 1)
            {
                CheckIfDead();
            }

            if (this.DevastationLife > 0)
            {
                Regain           = Math.Min(regainEnergyPercentage * DevastationLife, MaxRegain);
                DevastationLife += Regain;

                var p = UnityEngine.Random.Range(0f, 1f);
                if (p < 0.8)
                {
                    AffectedArea += regainEnergyPercentage * AffectedArea;
                }
            }

            IncreaseSeverity();
        }
    }