예제 #1
0
    public void RemoveDurability(float amount)
    {
        if (!Broken)
        {
            _durability -= amount;
            if (_durability < 0)
            {
                _durability = 0;
            }

            if (_durability <= 0)
            {
                if (_currentSignalPulse != null)
                {
                    _currentSignalPulse.Animator.SetTrigger("Fizzle");
                }
                _needsRepair = true;
                TruckController truck = Instantiate(_truckPrefab).GetComponent <TruckController>();
                truck.Initialize(this);
                if (_transmitCoroutine != null)
                {
                    StopCoroutine(_transmitCoroutine);
                }
                _animator.SetBool("broken", true);
                Transmitting = false;
            }

            StopCoroutine(DamageBlinkCoroutine());
            StopCoroutine(DamageShakeCoroutine());
            StartCoroutine(DamageBlinkCoroutine());
            StartCoroutine(DamageShakeCoroutine());
        }
    }