Exemplo n.º 1
0
        public override void Read(XmlNode os)
        {
            foreach (XmlNode current in XmlObject.GetChilds(os))
            {
                switch (current.Name)
                {
                case "Id":
                    this.Id = XmlObject.ReadInt(current);
                    break;

                case "AddBuffID":
                    this.AddBuffID = XmlObject.ReadInt(current);
                    break;

                case "Waves":
                {
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                        {
                            MapMonsterWave data = new MapMonsterWave();
                            data.Read(pNode);
                            Waves.Add(data);
                        });
                }
                break;
                }
            }
        }
Exemplo n.º 2
0
        public override XmlObject Export()
        {
            MapMonsterWave data = new MapMonsterWave();

            data.Index     = Index;
            data.IndexName = IndexName;
            data.Delay     = Delay;
            data.Spawn     = Spawn;
            for (int i = 0; i < Elements.Count; i++)
            {
                data.Monsters.Add(Elements[i].Export() as MapMonsterCall);
            }
            return(data);
        }
Exemplo n.º 3
0
        private void CreateWaveMonsters(MapMonsterWave pWaveData)
        {
            mIsCreateDone = false;
            switch (pWaveData.Spawn)
            {
            case MonsterWaveSpawnType.Whole:
            {
                pWaveData.Monsters.ForEach(delegate(MapMonsterCall data)
                    {
                        CreateMonster(data);
                    });
                CurrIndex++;
                mIsCreateDone = true;
            }
            break;

            case MonsterWaveSpawnType.Along:
            {
                for (int i = 0; i < pWaveData.Monsters.Count; i++)
                {
                    MapMonsterCall data   = pWaveData.Monsters[i];
                    float          delay  = 0.2f + 0.2f * i;
                    bool           isDone = (i == pWaveData.Monsters.Count - 1);
                    GameEntry.Coroutinue.StartCoroutine(CreateMonsterDelay(data, delay, isDone));
                }
                CurrIndex++;
            }
            break;

            case MonsterWaveSpawnType.Radom:
            {
                int range = UnityEngine.Random.Range(0, pWaveData.Monsters.Count);
                CreateMonster(pWaveData.Monsters[range]);
                CurrIndex++;
                mIsCreateDone = true;
            }
            break;
            }
            if (Region != null)
            {
                Region.ActiveEventsByCondition(TriggerConditionType.WaveIndex, CurrIndex);
            }
        }
Exemplo n.º 4
0
        public override void Import(XmlObject pData, bool pBuild)
        {
            MapMonsterWave data = pData as MapMonsterWave;

            Index     = data.Index;
            IndexName = data.IndexName;
            Delay     = data.Delay;
            Spawn     = data.Spawn;
            this.Build();
            this.SetName();
            if (pBuild)
            {
                for (int i = 0; i < data.Monsters.Count; i++)
                {
                    GameObject       go    = gameObject.AddChild();
                    LevelMonsterCall pCall = go.AddComponent <LevelMonsterCall>();
                    pCall.Import(data.Monsters[i], pBuild);
                }
            }
        }