public LogicCharacter(LogicGameObjectData data, LogicLevel level, int villageType) : base(data, level, villageType) { LogicCharacterData characterData = (LogicCharacterData)data; this.m_flying = characterData.IsFlying(); this.AddComponent(new LogicHitpointComponent(this, characterData.GetHitpoints(0), 0)); this.AddComponent(new LogicCombatComponent(this)); this.AddComponent(new LogicMovementComponent(this, characterData.GetSpeed(), characterData.IsFlying(), characterData.IsUnderground())); this.SetUpgradeLevel(0); int childTroopCount = characterData.GetChildTroopCount(); if (childTroopCount > 0) { this.m_childrens = new LogicArrayList <LogicCharacter>(childTroopCount); for (int i = 0; i < childTroopCount; i++) { LogicCharacter character = new LogicCharacter(characterData.GetChildTroop(), level, villageType); character.SetTroopChild(this, i); character.GetCombatComponent().SetTroopChild(true); this.m_childrens.Add(character); this.GetGameObjectManager().AddGameObject(character, -1); } } this.m_ejectPosition = new LogicVector2(); this.m_summonTroops = new LogicArrayList <LogicCharacter>(); if (characterData.IsUnderground()) { this.GetCombatComponent().SetUndergroundTime(3600000); } }