Esempio n. 1
0
    public static List <ZWActionEvent> CreateEffect <T>(RoleObject ro, ZWAction farther, Action.ActionEvent aevent, out float Duration, SkillContext context = null, int index = 0, params object[] args) where T : ZWActionEvent
    {
        Duration = 0;
        List <ZWActionEvent> list = new List <ZWActionEvent>();
        T result = null;

        SkillContext.FireBoll fireBoll = null;
        int count = aevent.Child.Length + 1;
        int wave  = 1;

        if (context != null)
        {
            if (aevent.EventType == ActionEventType.FIREBALL)
            {
                if (context.targets.Count > index)
                {
                    fireBoll = context.targets[index];
                }
            }
            wave = context.Wave;
        }

        for (int i = 0; i < wave; i++)
        {
            for (int j = 0; j < count; j++)
            {
                if (args == null)
                {
                    result = Activator.CreateInstance(typeof(T)) as T;
                }
                else
                {
                    result = Activator.CreateInstance(typeof(T), args) as T;
                }

                Action.Childs child = null;

                if (j > 0 && aevent.Child.Length > j - 1)
                {
                    child = aevent.Child[j - 1];
                }

                result.config   = aevent;
                result.fireBoll = fireBoll;
                float time = result.Initialize(ro, farther, child, aevent.Duration * i);
                Duration = Mathf.Max(time, Duration);
                list.Add(result);
            }
        }
        return(list);
    }
Esempio n. 2
0
 //初始化
 public float Initialize(RoleObject ro, ZWAction farther, Action.Childs child, float Duration)
 {
     this.parent     = ro;
     this.farther    = farther;
     this.Angle      = config.Angle;
     this.Offset     = config.Offset;
     this.StartTime  = this.config.StartTime;
     this.PathType   = config.PathType;
     this.OffsetMaxY = config.OffsetMaxY;
     if (child != null)
     {
         this.Angle     += child.Angle;
         this.Offset    += child.Offset;
         Duration       += child.Duration;
         this.PathType   = child.PathType;
         this.OffsetMaxY = child.OffsetMaxY;
     }
     this.StartTime += Duration;
     OnInit();
     return(Duration);
 }