using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Bausatz { public class Target : MonoBehaviour { private Light _light; private bool _isHit; private void Awake() { _light = GetComponentInChildren<Light>(); } public void Hit() { if (_isHit) return; _light.color = Color.green; _isHit = true; Invoke(nameof(ResetLight), 2f); } private void ResetLight() { _light.color = Color.white; _isHit = false; } } }