private IEnumerator WaitForDurationThenUnapply(Character character) { yield return(new WaitForSeconds(Duration)); StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Stop); _isStatusEffectActive[character] = false; Unapply(character); }
public override bool UnEquip(string playerID) { var character = TargetInventory(playerID).Owner.GetComponentInParent <Character>(); foreach (var statusEffect in StatusEffects) { StatusEffectEvent.Trigger(statusEffect, character, StatusEffectEventTypes.Unapply); } return(true); }
protected override void Colliding(GameObject collider) { if (!this.isActiveAndEnabled) { return; } // if the object we're colliding with is part of our ignore list, we do nothing and exit if (_ignoredGameObjects.Contains(collider)) { return; } // if what we're colliding with isn't part of the target layers, we do nothing and exit if (!MMLayers.LayerInLayerMask(collider.layer, TargetLayerMask)) { return; } // if we're on our first frame, we don't apply damage if (Time.time == 0f) { return; } // we get the character and apply all the status effects in the list _character = collider.gameObject.MMGetComponentNoAlloc <Character>(); if (_character != null) { foreach (var statusEffect in StatusEffects) { StatusEffectEvent.Trigger(statusEffect, _character, StatusEffectEventTypes.Apply); } } _colliderHealth = collider.gameObject.MMGetComponentNoAlloc <Health>(); // if what we're colliding with is damageable if (_colliderHealth != null) { if (_colliderHealth.CurrentHealth > 0) { OnCollideWithDamageable(_colliderHealth); } } // if what we're colliding with can't be damaged else { OnCollideWithNonDamageable(); } }
public override void Apply(Character character) { _isStatusEffectActive.TryGetValue(character, out var statusEffectActive); if (statusEffectActive) { character.StopCoroutine(_coroutines[character]); Unapply(character); } else { StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Start); } _isStatusEffectActive[character] = true; _coroutines[character] = character.StartCoroutine(WaitForDurationThenUnapply(character)); }
protected override void Unapply(Character character) { StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Stop); _multipliers[character] /= Multiplier; }
public override void Apply(Character character) { StatusEffectEvent.Trigger(this, character, StatusEffectEventTypes.Start); _multipliers[character] *= Multiplier; }
private void StatusEffectStopFeedbacksTest() { StatusEffectEvent.Trigger(StatusEffect, Character, StatusEffectEventTypes.Stop); }
private void ApplyStatusEffectTest() { StatusEffectEvent.Trigger(StatusEffect, Character, StatusEffectEventTypes.Apply); }