コード例 #1
0
    private void OnTriggerStay(Collider other)
    {
        // Increasing the seconds to the heal post stay only heal every second, and not every frame
        _CountSeconds += Time.deltaTime;

        if (_CountSeconds >= 1f)
        {
            AUnit aunit = other.gameObject.GetComponent <AUnit>();
            if (aunit != null)
            {
                aunit.Heal(_HealingPoints);
            }
            _CountSeconds = 0f;
        }
    }