private void Awake() { Health = new SensitiveIntValue(CompareMode.LessThan, healthInitValue, 0); Health.Triggered.AddListener(OnHealthZero); Type type = Type.GetType(DeathStrategy.ToString()); //target type healthZeroStrategy = (BehaviourStrategy)Activator.CreateInstance(type); // an instance of target type }
private void Awake() { healthZeroEvent = new UnityEvent(); playerHp = new SensitiveIntValue(CompareMode.LessThan, levelConfiguration.playerStartHP, 0); playerHp.Triggered.AddListener(delegate { healthZeroEvent?.Invoke(); }); }