예제 #1
0
    public void TakeHit()
    {
        bool destroyed = false;


        if (!indestructable)
        {
            health -= GameStateManager.instance.currentMode.instantDestruction ? 1000 : 1;

            if (health <= 0)
            {
                destroyed = true;
                HandleDeath();
            }
            else
            {
                rend.sprite = destructionStages[health - 1];
            }
        }

        if (shake != null && !destroyed)
        {
            EffectsConfig.instance.HandleBlockShake(transform.position);
            shake.AddShake();
        }
    }
예제 #2
0
 public void StartShake()
 {
     StartCoroutine(_shake.AddShake(duration, force * Mathf.Max(0, (distance - (_controller.transform.position - transform.position).magnitude) / distance)));
 }