Example #1
0
 public override void SetData(object[] data)
 {
     Target       = (Transform)data[0];
     TargetObject = (GameObject)data[1];
     skillunit    = (JSkillUnit)data[2];
     effectunit   = (SkillEffectUnit)data[3];
 }
 private void OnEnable()
 {
     if (skillunit == null)
     {
         skillunit = new JSkillUnit();
     }
     if (effectunit == null)
     {
         effectunit = new SkillEffectUnit();
     }
 }
 private void OnEnable()
 {
     if (skillArt == null)
     {
         skillArt = new SkillArt();
     }
     if (skillUnit == null)
     {
         skillUnit = new JSkillUnit();
     }
 }
        public JSkillUnit Copy()
        {
            JSkillUnit b = new JSkillUnit();

            b.id         = id;
            b.referId    = referId;
            b.launchType = launchType;
            b.artId      = artId;
            b.cd         = cd;
            b.skillTime  = skillTime;
            b.distance   = distance;
            b.targetType = targetType;
            b.SkillData  = SkillData;
            if (skillObj is SkillLine)
            {
                b.skillObj = ((SkillLine)skillObj).Copy();
            }
            if (skillObj is SkillMultiLine)
            {
                b.skillObj = ((SkillMultiLine)skillObj).Copy();
            }
            if (skillObj is SkillJump)
            {
                b.skillObj = ((SkillJump)skillObj).Copy();
            }
            if (skillObj is SkillHelix)
            {
                b.skillObj = ((SkillHelix)skillObj).Copy();
            }
            if (skillObj is SkillFollow)
            {
                b.skillObj = ((SkillFollow)skillObj).Copy();
            }
            if (skillObj is SkillBackStab)
            {
                b.skillObj = ((SkillBackStab)skillObj).Copy();
            }
            if (skillObj is SkillArea)
            {
                b.skillObj = ((SkillArea)skillObj).Copy();
            }
            if (skillObj is SkillAreaRand)
            {
                b.skillObj = ((SkillAreaRand)skillObj).Copy();
            }

            if (guidePolicy != null)
            {
                b.guidePolicy = guidePolicy.Copy();
            }

            return(b);
        }
        //绘制技能信息区域
        public static void DrawSkillUnit(JSkillUnit unit)
        {
            EditorGUILayout.BeginVertical("Box");
            EditorGUILayout.LabelField("Skill unit: 技能信息");
            JSkillUnit.LaunchType lt = unit.launchType;
            int newlt = EditorGUILayout.Popup("  LaunchType:", (int)lt, Enum.GetNames(typeof(JSkillUnit.LaunchType)));

            if (newlt != (int)lt)
            {
                unit.launchType = (JSkillUnit.LaunchType)newlt;
            }
            JSkillUnit.TargetType tt = unit.targetType;
            int newtt = EditorGUILayout.Popup("  TargetType:", (int)tt, Enum.GetNames(typeof(JSkillUnit.TargetType)));

            if (newtt != (int)tt)
            {
                unit.targetType = (JSkillUnit.TargetType)newtt;
            }
            unit.skillTime = EditorGUILayout.IntField("  skillTime:", unit.skillTime);
            unit.cd        = EditorGUILayout.IntField("  cd:", unit.cd);
            unit.distance  = EditorGUILayout.FloatField("  distance:", unit.distance);
            unit.referId   = EditorGUILayout.IntField("  referId:", unit.referId);
            unit.artId     = EditorGUILayout.IntField("  artId:", unit.artId);
            if (unit.guidePolicy != null)
            {
                DrawGuidePolicy(unit.guidePolicy);
            }
            else
            {
                if (GUILayout.Button("Add GuidePolicy:添加引导策略"))
                {
                    unit.guidePolicy = new SkillGuidePolicy();
                }
            }


            EditorGUILayout.LabelField("弹道信息:");
            if (unit.skillObj != null)
            {
                if (unit.launchType == JSkillUnit.LaunchType.SINGLELINE)
                {
                    if (!(unit.skillObj is SkillLine))
                    {
                        unit.skillObj = new SkillLine();
                    }
                    DrawSkillSingleLine((SkillLine)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.MULLINE)
                {
                    if (!(unit.skillObj is SkillMultiLine))
                    {
                        unit.skillObj = new SkillMultiLine();
                    }
                    DrawSkillMultiLine((SkillMultiLine)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.AREA)
                {
                    if (!(unit.skillObj is SkillArea))
                    {
                        unit.skillObj = new SkillArea();
                    }
                    DrawSkillArea((SkillArea)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.JUMP)
                {
                    if (!(unit.skillObj is SkillJump))
                    {
                        unit.skillObj = new SkillJump();
                    }
                    DrawSkillJump((SkillJump)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.AREA_RANDSKILL)
                {
                    if (!(unit.skillObj is SkillAreaRand))
                    {
                        unit.skillObj = new SkillAreaRand();
                    }
                    DrawSkillAreaRandom((SkillAreaRand)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.HELIX)
                {
                    if (!(unit.skillObj is SkillHelix))
                    {
                        unit.skillObj = new SkillHelix();
                    }
                    DrawSkillHelix((SkillHelix)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.FOLLOW)
                {
                    if (!(unit.skillObj is SkillFollow))
                    {
                        unit.skillObj = new SkillFollow();
                    }
                    DrawSkillFollow((SkillFollow)unit.skillObj);
                }
                if (unit.launchType == JSkillUnit.LaunchType.BACK_STAB)
                {
                    if (!(unit.skillObj is SkillBackStab))
                    {
                        unit.skillObj = new SkillBackStab();
                    }
                    DrawSkillBackStab((SkillBackStab)unit.skillObj);
                }
            }
            else
            {
                if (GUILayout.Button("Add New Unit:添加弹道"))
                {
                    unit.skillObj = new SkillLine();
                }
            }
            EditorGUILayout.EndVertical();
        }
Example #6
0
 public static void ConvertSkillUnit(SkillUnit.SkillUnit oUnit, JSkillUnit unit)
 {
     oUnit.id          = unit.id;
     oUnit.artId       = unit.artId;
     oUnit.launchType  = (SkillUnit.SkillUnit.LaunchType)(int) unit.launchType;
     oUnit.targetType  = (SkillUnit.SkillUnit.TargetType)(int) unit.targetType;
     oUnit.skillTime   = unit.skillTime;
     oUnit.cd          = unit.cd;
     oUnit.distance    = unit.distance;
     oUnit.referId     = unit.referId;
     oUnit.guidePolicy = ConvertSkillGuidePolicy(unit.guidePolicy);
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.SINGLELINE)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.singeLines.Count && unit.referId >= 0)
         {
             SkillUnit.SkillLine line = EditorDataContainer.allSkillUnits.singeLines[unit.referId];
             line = ConvertSkillLine((SkillLine)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.MULLINE)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.multLines.Count && unit.referId >= 0)
         {
             SkillUnit.SkillMultiLine line = EditorDataContainer.allSkillUnits.multLines[unit.referId];
             line = ConvertSkillMultiLine((SkillMultiLine)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.AREA)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.areas.Count && unit.referId >= 0)
         {
             SkillUnit.SkillArea line = EditorDataContainer.allSkillUnits.areas[unit.referId];
             line = ConvertSkillArea((SkillArea)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.JUMP)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.jumps.Count && unit.referId >= 0)
         {
             SkillUnit.SkillJump line = EditorDataContainer.allSkillUnits.jumps[unit.referId];
             line = ConvertSkillJump((SkillJump)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.AREA_RANDSKILL)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.areaRands.Count && unit.referId >= 0)
         {
             SkillUnit.SkillAreaRand line = EditorDataContainer.allSkillUnits.areaRands[unit.referId];
             line = ConvertSkillAreaRand((SkillAreaRand)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.HELIX)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.helixes.Count && unit.referId >= 0)
         {
             SkillUnit.SkillHelix line = EditorDataContainer.allSkillUnits.helixes[unit.referId];
             line = ConvertSkillHelix((SkillHelix)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.FOLLOW)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.follows.Count && unit.referId >= 0)
         {
             SkillUnit.SkillFollow line = EditorDataContainer.allSkillUnits.follows[unit.referId];
             line = ConvertSkillFollow((SkillFollow)unit.skillObj);
         }
     }
     if (oUnit.launchType == SkillUnit.SkillUnit.LaunchType.BACK_STAB)
     {
         if (unit.referId < EditorDataContainer.allSkillUnits.backStabs.Count && unit.referId >= 0)
         {
             SkillUnit.SkillBackStab line = EditorDataContainer.allSkillUnits.backStabs[unit.referId];
             line = ConvertSkillBackStab((SkillBackStab)unit.skillObj);
         }
     }
 }
        public void AddClipWithName(string effectName, float startTime, float PlayBackduration, JSkillUnit unit, SkillEffectUnit effectUnit)
        {
            var clipData = ScriptableObject.CreateInstance <JTrajectoryClipData>();

            clipData.TargetObject     = TimeLine.AffectedObject.gameObject;
            clipData.StateName        = effectName;
            clipData.effectunit       = effectUnit;
            clipData.skillunit        = unit;
            clipData.StartTime        = startTime;
            clipData.PlaybackDuration = PlayBackduration;
            clipData.Track            = this;
            AddClip(clipData);
        }