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(); } }
public void StartShake() { StartCoroutine(_shake.AddShake(duration, force * Mathf.Max(0, (distance - (_controller.transform.position - transform.position).magnitude) / distance))); }