Beispiel #1
0
    void Start()
    {
        m_AtmosphereConsumer = GetComponent <CActorAtmosphericConsumer>();

        if (CGamePlayers.SelfActor == gameObject)
        {
            EventEnviromentalOxygenChange += OnEnviromentOxygenChange;
        }

        CUserInput.SubscribeInputChange(CUserInput.EInput.Visor, OnEventInput);
    }
Beispiel #2
0
    private void UpdateAtmosphereQuantity()
    {
        float consumptionAmount = 0.0f;
        float refillAmount      = 0.0f;

        // If the atmosphere is being consumed, calculate the consumption rate
        if (m_AtmosphericConsumers.Count != 0)
        {
            // Calculate the consumption amount
            consumptionAmount = -AtmosphereConsumeRate * Time.deltaTime;
        }

        // If the facility requires a refill, calculate the refill rate
        if (RequiresAtmosphereRefill)
        {
            refillAmount = AtmosphereRefillRate * Time.deltaTime;
        }

        // Combine the refill and consumption amounts to get the final rate
        float finalAmount = consumptionAmount + refillAmount;

        // Calculate the new quantity
        float newQuantity = AtmosphereQuantity + finalAmount;

        // Clamp atmosphere
        if (newQuantity > AtmosphereVolume)
        {
            newQuantity = AtmosphereVolume;
        }
        else if (newQuantity < 0.0f)
        {
            newQuantity = 0.0f;

            // There was inssuficent atmosphere, let the consumers know
            foreach (GameObject consumer in m_AtmosphericConsumers)
            {
                CActorAtmosphericConsumer aac = consumer.GetComponent <CActorAtmosphericConsumer>();

                if (aac.IsConsumingAtmosphere)
                {
                    aac.InsufficientAtmosphere();
                }
            }
        }

        // Increase atmosphere amount
        m_AtmosphereQuantity.Set(newQuantity);
    }
Beispiel #3
0
    private void UpdateConsumptionRate()
    {
        // Calulate the combined consumption rate within the facility
        float consumptionRate = 0.0f;

        foreach (GameObject consumer in m_AtmosphericConsumers)
        {
            CActorAtmosphericConsumer aac = consumer.GetComponent <CActorAtmosphericConsumer>();

            if (aac.IsConsumingAtmosphere)
            {
                consumptionRate += aac.AtmosphericConsumptionRate;
            }
        }

        // Set the consumption rate
        AtmosphereConsumeRate = consumptionRate;
    }
Beispiel #4
0
	void Start()
	{
		m_AtmosphereConsumer = GetComponent<CActorAtmosphericConsumer>();

		if(CGamePlayers.SelfActor == gameObject)
			EventEnviromentalOxygenChange += OnEnviromentOxygenChange;

		CUserInput.SubscribeInputChange(CUserInput.EInput.Visor, OnEventInput);
	}