コード例 #1
0
        protected override bool _TryReact(MAnimal animal)
        {
            var mode = animal.Mode_Get(ID);

            if (mode == null || ID == null)
            {
                return(false);
            }

            switch (type)
            {
            case Mode_Reaction.Activate:
                return(animal.Mode_TryActivate(ID, AbilityIndex, abilityStatus, AbilityTime));

            case Mode_Reaction.Interrupt:
                if (animal.ActiveMode.ID == ID)
                {
                    animal.Mode_Interrupt();
                    return(true);
                }
                return(false);

            case Mode_Reaction.SetActiveIndex:
                mode.SetAbilityIndex(AbilityIndex);
                return(true);

            case Mode_Reaction.ResetActiveIndex:
                mode.ResetAbilityIndex();
                return(true);

            case Mode_Reaction.Enable:
                animal.Mode_Enable(ID);
                return(true);

            case Mode_Reaction.Disable:
                animal.Mode_Disable(ID);
                return(true);

            case Mode_Reaction.CoolDown:
                mode.CoolDown.Value = coolDown;
                return(true);

            case Mode_Reaction.ForceActivate:
                animal.Mode_ForceActivate(ID, AbilityIndex);
                return(true);

            case Mode_Reaction.ActivateForever:
                return(animal.Mode_TryActivate(ID, AbilityIndex, AbilityStatus.Forever));

            case Mode_Reaction.Stop:
                animal.Mode_Stop();
                return(true);

            case Mode_Reaction.EnableAbility:
                return(animal.Mode_Ability_Enable(ID, AbilityIndex, true));

            case Mode_Reaction.DisableAbility:
                return(animal.Mode_Ability_Enable(ID, AbilityIndex, false));

            default:
                return(false);
            }
        }