protected virtual List <Lifetime> CreateLifetimes(ModifierInfo modifierInfo)
        {
            List <Lifetime> lifetimes = new List <Lifetime>();

            foreach (LifetimeConfig lc in info.ShowLifetimeConfigs())
            {
                switch (lc.ShowType())
                {
                case LifetimeType.Duration:
                    DurationInSecondsLifetimeConfig dis = (DurationInSecondsLifetimeConfig)lc;
                    DurationBasedLifetime           durationBasedLifetime = new DurationBasedLifetime(dis.duration);
                    configByLifetime[durationBasedLifetime] = lc;
                    lifetimes.Add(durationBasedLifetime);
                    break;

                case LifetimeType.ParentSkill:
                    ParentSkillBasedLifetime parentSkillBasedLifetime = new ParentSkillBasedLifetime(info.ShowParentSkill());
                    configByLifetime[parentSkillBasedLifetime] = lc;
                    lifetimes.Add(parentSkillBasedLifetime);
                    break;

                case LifetimeType.DurationInFrames:
                    DurationInFramesLifetimeConfig dif = (DurationInFramesLifetimeConfig)lc;
                    durationBasedLifetime = new DurationBasedLifetime(FrameAndSecondsConverter._30Fps.FloatFramesToSeconds(dif.duration));
                    configByLifetime[durationBasedLifetime] = lc;
                    lifetimes.Add(durationBasedLifetime);
                    break;

                case LifetimeType.SuccessfulHit:
                    SuccessfulHitLifetimeConfig shl = (SuccessfulHitLifetimeConfig)lc;
                    SuccessfulHitLifetime       successfulHitLifetime = new SuccessfulHitLifetime(shl.count, shl.ShowCategories(), targetEntity.GetComponent <SkillComponent>().Character);
                    configByLifetime[successfulHitLifetime] = lc;
                    lifetimes.Add(successfulHitLifetime);
                    break;

                case LifetimeType.SpecificSkillStateExit:
                    SpecificSkillStateExitLifetimeConfig ssselc = (SpecificSkillStateExitLifetimeConfig)lc;
                    SpecificSkillStateExitLifetime       specificSkillStateExitLifetime = new SpecificSkillStateExitLifetime(
                        ssselc, targetEntity.GetComponent <SkillComponent>().Character
                        );
                    configByLifetime[specificSkillStateExitLifetime] = ssselc;
                    lifetimes.Add(specificSkillStateExitLifetime);
                    break;

                case LifetimeType.SpecificSkillFinish:
                    SpecificSkillFinishLifetimeConfig ssflc = (SpecificSkillFinishLifetimeConfig)lc;
                    SpecificSkillFinishLifetime       specificSkillFinishLifetime = new SpecificSkillFinishLifetime(
                        ssflc, targetEntity.GetComponent <SkillComponent>().Character
                        );
                    configByLifetime[specificSkillFinishLifetime] = ssflc;
                    lifetimes.Add(specificSkillFinishLifetime);
                    break;

                case LifetimeType.ParentSkillHitTarget:
                    ParentSkillHitTargetLifetime pshtl = new ParentSkillHitTargetLifetime(
                        targetEntity.GetComponent <SkillComponent>().Character, modifierInfo.ShowParentSkill()
                        );
                    configByLifetime[pshtl] = lc;
                    lifetimes.Add(pshtl);
                    break;

                case LifetimeType.ParentSkillStateExit:
                    ParentSkillStateExitLifetime pssel = new ParentSkillStateExitLifetime(modifierInfo.ShowParentSkill());
                    configByLifetime[pssel] = lc;
                    lifetimes.Add(pssel);
                    break;

                default:
                    throw new Exception("Missing logic to create lifetime of type " + lc.ShowType());
                }
            }

            return(lifetimes);
        }
Exemple #2
0
 public SpecificSkillFinishLifetime(SpecificSkillFinishLifetimeConfig config,
                                    Character targetCharacter)
 {
     this.config          = config;
     this.targetCharacter = targetCharacter;
 }