Ejemplo n.º 1
0
    public IEnumerator PenaltyRoutine(int playerShotsFired)
    {
        // It's fine if a few penalty points take a "long" time to process, but it needs to be fast when there's a lot of them
        float penaltyCycleInterval = m_penaltyPointInterval;

        if (playerShotsFired * m_penaltyPointInterval > m_penaltySpeedUpTimeLimit)
        {
            penaltyCycleInterval = Mathf.Clamp(m_penaltySpeedUpTimeLimit / playerShotsFired, m_penaltyPointIntervalMin, m_penaltyPointInterval);
        }

        //Debug.Log(DebugUtilities.AddTimestampPrefix("Shots penalty being applied! Cycle interval: " + penaltyCycleInterval));

        int penaltyAmount = 0;

        while (playerShotsFired > 0)
        {
            playerShotsFired--;
            ScenarioManager.SetShotsFired(playerShotsFired);
            ScenarioManager.ModifyScore(-5);

            penaltyAmount += 5;
            SetPenaltyAmount(-penaltyAmount);

            if (m_penaltyPointSFX != null)
            {
                Debug.Log(DebugUtilities.AddTimestampPrefix("Chuck!"));
                m_penaltyPointSFX.PlayOnSource(m_uiAudio);
            }

            yield return(new WaitForSecondsRealtime(penaltyCycleInterval));
        }
    }
Ejemplo n.º 2
0
    public void OnHit()
    {
        // Deduct score if "killed"
        if (m_canControl)
        {
            ScenarioManager.ModifyScore(-m_turret.m_killScore);
        }

        SetCanControl(false);
    }