public void Setup(ICharacterEvents _charEv)
 {
     _charEv.onMovementChange.AddListener(OnMovementChange);
     _charEv.onFacingRightChange.AddListener(OnFacingRightChange);
     _charEv.onGroundedChange.AddListener(OnGroundedChange);
     _charEv.onJumpingChange.AddListener(OnJumpingChange);
     _charEv.onAttackChange.AddListener(OnAttackChange);
     _charEv.onDashChange.AddListener(OnDashingChange);
     _charEv.onAirDashChange.AddListener(OnAirDashingChange);
     _charEv.onClingChange.AddListener(OnClingChange);
 }
Esempio n. 2
0
        private void DetachEvents(ICharacterEvents character)
        {
            foreach (var hookPoint in _hookPoints)
            {
                switch (hookPoint)
                {
                case HookPoint.TakingDamage:
                    character.TakingDamage -= OnTakingDamage;
                    break;

                case HookPoint.RollingEvasion:
                    character.RollingEvasion -= OnRollingEvasion;
                    break;

                case HookPoint.AttackDodged:
                    character.AttackDodged -= OnAttackDodged;
                    break;

                case HookPoint.AttackBlocked:
                    character.AttackBlocked -= OnAttackBlocked;
                    break;

                case HookPoint.Dying:
                    character.Dying -= OnDying;
                    break;

                case HookPoint.UsingMP:
                    character.UsingMP -= OnUsingMP;
                    break;

                case HookPoint.Healing:
                    character.Healing -= OnHealing;
                    break;

                case HookPoint.ApplyingBuff:
                    character.ApplyingBuff -= OnApplyingBuff;
                    break;

                case HookPoint.ApplyingDebuff:
                    character.ApplyingDebuff -= OnApplyingDebuff;
                    break;

                case HookPoint.BuffingStat:
                    character.BuffingStat -= OnBuffingStat;
                    break;

                case HookPoint.RemovingDebuffs:
                    character.RemovingDebuffs -= OnRemovingDebuffs;
                    break;

                case HookPoint.RemovingBuffs:
                    character.RemovingBuffs -= OnRemovingBuffs;
                    break;

                case HookPoint.TurnCounterUpdating:
                    character.TurnCounterUpdating -= OnTurnCounterUpdating;
                    break;

                case HookPoint.TurnTriggered:
                    character.TurnTriggered -= OnTurnTriggered;
                    break;

                case HookPoint.TurnCounterUpdated:
                    character.TurnCounterUpdated -= OnTurnCounterUpdated;
                    break;

                case HookPoint.Attacking:
                    character.Attacking -= OnAttacking;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }