예제 #1
0
    // 清理当前刷怪器 只是清理掉当前Step的怪物 刷怪会继续刷下一波 想直接停掉请用下面那个DestroyCurGrowthTrigger
    public void ClearCurGrowthTrigger()
    {
        foreach (BaseTrigger trigger in mTriggers.Values)
        {
            if (!trigger.IsRunning())
            {
                continue;
            }

            if (trigger.IsTrigger(TriggerType.Growth))
            {
                GrowthTrigger growthtrigger = trigger as GrowthTrigger;
                growthtrigger.ClearCache();
            }
        }
    }
예제 #2
0
    // 清理当前刷怪器刷的怪物 并终止
    public void DestroyCurGrowthTrigger()
    {
        foreach (BaseTrigger trigger in mTriggers.Values)
        {
            if (!trigger.IsRunning())
            {
                continue;
            }

            if (trigger.IsTrigger(TriggerType.Growth))
            {
                GrowthTrigger growthtrigger = trigger as GrowthTrigger;
                growthtrigger.Destroy();
                growthtrigger.Reset();
            }
        }
    }
예제 #3
0
    // 解析NpcGrowth
    private void ParseNpcGrowth(XmlNode node)
    {
        GrowthTrigger trigger = new GrowthTrigger(mScene);

        trigger.name = node.Attributes["name"].Value;
        XmlNodeList nodeList = node.ChildNodes;

        for (int i = 0; i < nodeList.Count; ++i)
        {
            XmlNode childNode = nodeList[i];
            if (childNode != null && childNode.Name == "Step")
            {
                GrowthTriggerStep step = new GrowthTriggerStep();
                int ka = System.Convert.ToInt32(childNode.Attributes["killAll"].Value);
                step.killAll = (ka != 0);
                step.time    = System.Convert.ToInt32(childNode.Attributes["time"].Value);

                if (childNode.Attributes["repeat"] != null && childNode.Attributes["spacetime"] != null)
                {
                    step.repeat    = System.Convert.ToInt32(childNode.Attributes["repeat"].Value);
                    step.spacetime = System.Convert.ToInt32(childNode.Attributes["spacetime"].Value);
                }

                XmlNodeList stepList = childNode.ChildNodes;
                for (int j = 0; j < stepList.Count; ++j)
                {
                    XmlNode stepNode = stepList[j];

                    if (stepNode != null && stepNode.Name == "Growth")
                    {
                        GrowthTriggerInfo info       = null;
                        string            growthtype = stepNode.Attributes["type"].Value;
                        if (growthtype.Equals("PICK"))
                        {
                            info = new PickGrowthTriggerInfo();
                            (info as PickGrowthTriggerInfo).picktype = System.Convert.ToInt32(stepNode.Attributes["picktype"].Value);
                            (info as PickGrowthTriggerInfo).content  = System.Convert.ToInt32(stepNode.Attributes["content"].Value);
                        }
                        else if (growthtype.Equals("BUILD"))
                        {
                            info = new BuildGrowthTriggerInfo();
                            (info as BuildGrowthTriggerInfo).barrier = System.Convert.ToInt32(stepNode.Attributes["barrier"].Value);
                        }
                        else
                        {
                            info = new GrowthTriggerInfo();
                        }

                        info.type  = growthtype;
                        info.resId = System.Convert.ToInt32(stepNode.Attributes["resId"].Value);
                        info.x     = System.Convert.ToSingle(stepNode.Attributes["x"].Value);
                        info.z     = System.Convert.ToSingle(stepNode.Attributes["z"].Value);
                        info.dir   = System.Convert.ToSingle(stepNode.Attributes["dir"].Value) * Mathf.Deg2Rad;

                        if (stepNode.Attributes["talkid"] != null)
                        {
                            info.talkID = System.Convert.ToInt32(stepNode.Attributes["talkid"].Value);
                        }

                        if (stepNode.Attributes["name"] != null)
                        {
                            info.alias = stepNode.Attributes["name"].Value;
                        }

                        step.objs.Add(info);
                    }
                }
                trigger.steps.Add(step);
            }
        }

        mTriggers.Add(trigger.name, trigger);
    }