public override void Read(XmlNode os) { foreach (XmlNode current in XmlObject.GetChilds(os)) { switch (current.Name) { case "Index": this.Index = ReadInt(current); break; case "IndexName": this.IndexName = ReadString(current); break; case "Delay": this.Delay = ReadFloat(current); break; case "Spawn": this.Spawn = (MonsterWaveSpawnType)ReadInt(current); break; case "Monsters": { XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode) { MapMonsterCall data = new MapMonsterCall(); data.Read(pNode); Monsters.Add(data); }); } break; } } }
private void CreateMonster(MapMonsterCall data) { Vector3 bornEulerAngles = data.EulerAngles; Vector3 bornPosition = GlobalTools.NavSamplePosition(data.Position); TransformParam param = TransformParam.Create(bornPosition, bornEulerAngles); int serialId = GameEntry.Level.CreateEnemy(data.Id, param); mMonsterGUIDSet.Add(serialId); }
private IEnumerator CreateMonsterDelay(MapMonsterCall data, float delay, bool isDone) { yield return(delay); CreateMonster(data); if (isDone != mIsCreateDone) { mIsCreateDone = isDone; } }
public override XmlObject Export() { MapMonsterCall data = new MapMonsterCall { Id = Id, Position = Position, EulerAngles = Euler }; return(data); }
public override void Import(XmlObject pData, bool pBuild) { MapMonsterCall data = pData as MapMonsterCall; if (data != null) { Id = data.Id; Position = data.Position; Euler = data.EulerAngles; } this.Build(); this.SetName(); }
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); } }