Beispiel #1
0
        private AoeFieldAction LoadAoeFieldAction(XmlElement node)
        {
            AoeFieldAction action = new AoeFieldAction();

            action.duration = float.Parse(node.GetAttribute("duration"));
            action.interval = float.Parse(node.GetAttribute("interval"));
            action.emitters = new List <BuffEmitter>();
            bool initRegion = false;

            for (int i = 0; i < node.ChildNodes.Count; ++i)
            {
                XmlElement child = (XmlElement)node.ChildNodes[i];
                switch (node.ChildNodes[i].Name)
                {
                case "CircleRegion":
                    action.type   = RegionType.kCircle;
                    action.radius = float.Parse(child.GetAttribute("radius"));
                    initRegion    = true;
                    break;

                case "RectRegion":
                    action.type   = RegionType.kRect;
                    action.width  = float.Parse(child.GetAttribute("width"));
                    action.height = float.Parse(child.GetAttribute("height"));
                    initRegion    = true;
                    break;

                case "SectorRegion":
                    action.type   = RegionType.kSector;
                    action.radius = float.Parse(child.GetAttribute("radius"));
                    action.theta  = float.Parse(child.GetAttribute("theta"));
                    initRegion    = true;
                    break;

                case "BuffEmitter":
                    BuffEmitter emitter = new BuffEmitter();
                    emitter.filter = (AoeFilter)Enum.Parse(typeof(AoeFilter), child.GetAttribute("filter"));
                    string[] buffs = child.GetAttribute("buffs").Split('|');
                    emitter.buffs = new int[buffs.Length];
                    for (int n = 0; n < buffs.Length; ++n)
                    {
                        emitter.buffs[n] = int.Parse(buffs[n]);
                    }
                    action.emitters.Add(emitter);
                    break;
                }
            }
            if (action.emitters.Count == 0)
            {
                throw new Exception("AoeFieldAction miss emitter!");
            }
            if (!initRegion)
            {
                throw new Exception("AoeFieldAction miss region!");
            }
            return(action);
        }
Beispiel #2
0
        public override SkillAction Copy(Skill skill)
        {
            AoeFieldAction act = new AoeFieldAction();

            act.userInput = userInput;
            act.duration  = duration;
            act.interval  = interval;
            act.type      = type;
            act.radius    = radius;
            act.width     = width;
            act.height    = height;
            act.theta     = theta;
            act.mSkill    = skill;
            act.emitters  = new List <BuffEmitter>();
            for (int i = 0; i < emitters.Count; ++i)
            {
                act.emitters.Add(emitters[i].Copy());
            }
            return(act);
        }