public void GenerateMercenaryInCamp(MercenaryType mercenaryType, IBuildingInfo campInfo) { GameObject mercenary = this.GenerateMercenary(mercenaryType); ArmyAI ai = mercenary.GetComponent <ArmyAI>(); ai.GenerateArmyInCamp(campInfo); }
public HireMercenaryCondition(TaskConditionConfigData conditionConfigData, Task task, int conditionID, int startValue, int currentValue) : base(conditionConfigData, task, conditionID, startValue, currentValue) { this.m_MercenaryType = (MercenaryType)conditionConfigData.Value1; this.m_Count = conditionConfigData.Value2; this.IsComplete = (this.Progress >= this.m_Count); }
public int GetMercenaryStartNO(MercenaryType type) { if (!this.m_UserData.MercenaryProgress.ContainsKey(type)) { return(0); } return(this.m_UserData.MercenaryProgress[type]); }
public override void OnHireMercenary(MercenaryType mercenaryType) { if (mercenaryType == this.m_MercenaryType) { this.CurrentValue++; this.IsComplete = (this.Progress >= this.m_Count); } }
public void OnHireMercenary(MercenaryType mercenaryType) { foreach (Task task in this.m_TaskList) { if (task.Status == TaskStatus.Opened) { task.OnHireMercenary(mercenaryType); } } }
public void SendMercenaryToCamp(MercenaryType mercenaryType, IBuildingInfo campInfo, IBuildingInfo factoryInfo) { GameObject mercenary = this.GenerateMercenary(mercenaryType); TilePosition initialPoint = BorderPointHelper.FindValidInflateOneBorderPoint(factoryInfo); mercenary.transform.position = PositionConvertor.GetWorldPositionFromActorTileIndex(initialPoint); ArmyAI ai = mercenary.GetComponent <ArmyAI>(); ai.SendArmyToCamp(campInfo); }
public void HireMercenary(MercenaryType type) { if (!this.m_UserData.MercenaryProgress.ContainsKey(type)) { this.m_UserData.MercenaryProgress.Add(type, 0); } this.m_UserData.MercenaryProgress[type]++; MercenaryConfigData configData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(type); this.Consume(configData.HireCostGold, configData.HireCostFood, configData.HireCostOil, configData.HireCostGem); }
public void HireMercenary(BuildingIdentity tavernID, MercenaryType type) { int no = this.m_PlayerModule.Data.GetMercenaryStartNO(type); MercenaryIdentity mercenaryID = new MercenaryIdentity(type, no); this.m_PlayerModule.HireMercenary(type); BuildingIdentity campID = this.m_BuildingModule.HireMercenary(mercenaryID, tavernID); this.m_MercenaryModule.HireMercenary(mercenaryID, campID); this.m_TaskModule.OnHireMercenary(type); }
public void ConstructMercenary(MercenaryType mercenaryType, Vector3 position, bool isPlaySound) { if (isPlaySound) { AudioController.Play("PutdownSoldier"); } MercenaryConfigData configData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(mercenaryType); GameObject mercenaryPrefab = this.m_PreloadManager.GetMercenaryPrefab(mercenaryType); this.ConstructCharacter(mercenaryPrefab, position, (BuildingCategory)configData.FavoriteType, configData.MaxHP, configData.ArmorCategory, configData.MoveVelocity, (TargetType)configData.Type, configData.AttackCD, configData.AttackValue, configData.AttackScope, configData.DamageScope, configData.AttackMiddleSpeed, configData.AttackCategory, (TargetType)configData.TargetType, configData.PushFactor, configData.PushAttenuateFactor); }
public virtual void OnHireMercenary(MercenaryType mercenaryType) { bool isCompleted = true; foreach (Condition condition in m_ConditionList) { condition.OnHireMercenary(mercenaryType); if (!condition.IsComplete) { isCompleted = false; } } if (isCompleted) { this.CompleteTask(); } }
public BuildingIdentity?FindMercenaryCamp(MercenaryType type) { int capacityCost = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(type).CapcityCost; if (capacityCost + this.CampsTotalAlreadyCapacity > this.CampsTotalCapacity) { return(null); } foreach (BuildingIdentity id in this.m_Camps) { BuildingLogicData building = LogicController.Instance.GetBuildingObject(id); if (this.GetAlreadyCapacity(building) < this.GetTotalCapacity(building)) { return(id); } } return(null); }
private GameObject GenerateMercenary(MercenaryType mercenaryType) { string prefabPath = ActorPrefabConfig.Instance.GetMercenaryActorPrefab(mercenaryType); GameObject mercenaryPrefab = Resources.Load(prefabPath) as GameObject; GameObject mercenary = GameObject.Instantiate(mercenaryPrefab) as GameObject; if (!this.m_Mercenaries.ContainsKey(mercenaryType)) { this.m_Mercenaries.Add(mercenaryType, new List <GameObject>()); } this.m_Mercenaries[mercenaryType].Add(mercenary); ActorConfig config = ActorPrefabConfig.Instance.GetComponent <ActorConfig>(); ArmyAI armyAI = mercenary.GetComponent <ArmyAI>(); armyAI.WalkVelocity = config.MercenaryMoveVelocity[mercenaryType]; armyAI.MapData = this.m_MapData; return(mercenary); }
public GameObject CreateMercenary(MercenaryType type, Vector3 position, float health, float range) { if (type == MercenaryType.BritishSoldier) { return(InitAgent(BritishSoldier, position, health, range)); } if (type == MercenaryType.GermanSoldier) { return(InitAgent(GermanSoldier, position, health, range)); } if (type == MercenaryType.GermanFlamethrower) { return(InitAgent(GermanFlamethrower, position, health, range)); } if (type == MercenaryType.SpecialUnit) { return(InitAgent(SpecialUnit, position, health, range)); } return(null); }
private void PreloadMercenary(MercenaryType mercenaryType) { if (!this.m_PreloadMercenaryPrefab.ContainsKey(mercenaryType)) { MercenaryConfigData configData = ConfigInterface.Instance.MercenaryConfigHelper.GetMercenaryData(mercenaryType); string prefabPath = string.Format("{0}{1}{2}", ClientStringConstants.BATTLE_SCENE_RESOURCE_PREFAB_PREFIX_NAME, ClientStringConstants.MERCENARY_OBJECT_PREFAB_PREFIX_NAME, configData.PrefabName); GameObject mercenaryPrefab = Resources.Load(prefabPath) as GameObject; this.m_PreloadMercenaryPrefab.Add(mercenaryType, mercenaryPrefab); KodoHPBehavior hp = mercenaryPrefab.GetComponent <KodoHPBehavior>(); if (hp != null) { foreach (DropArmySerializableInformation army in hp.DropArmies) { this.PreloadArmy(army.ArmyType, army.ArmyLevel); } foreach (MercenaryType mercenary in hp.DropMercenaries) { this.PreloadMercenary(mercenary); } } } }
public virtual void OnHireMercenary(MercenaryType mercenaryType) { }
public string GetMercenaryActorPrefab(MercenaryType mercenaryType) { return(ClientStringConstants.BUILDING_SCENE_RESOURCE_PREFAB_PREFIX_NAME + ClientStringConstants.ACTOR_OBJECT_PREFAB_PREFIX_NAME + MERCENARY_PREFAB_PREFIX + mercenaryType.ToString() + "/" + this.m_MercenaryPrefabName[mercenaryType]); }
public static string GetUIGridSortString(this MercenaryType mercenaryType) { string result = (int)mercenaryType > 9 ? ((int)mercenaryType).ToString() : "0" + ((int)mercenaryType).ToString(); result = MERCENARY_SORT_STRING_PREFIX + result; return result; }
public MercenaryProductLogicObject(MercenaryType type, MercenaryProductData data) { this.m_Type = type; this.m_Data = data; this.m_LogicData = new MercenaryProductLogicData(data); }
public MercenaryProduceComponent(MercenaryType type) { this.m_Type = type; }
public int GetMercenaryOrder(MercenaryType mercenaryType) { return(this.m_MercenaryOrders[mercenaryType]); }
public GameObject GetMercenaryPrefab(MercenaryType mercenaryType) { GameObject result = this.m_PreloadMercenaryPrefab[mercenaryType]; return(result); }
public void ConstructMercenary(MercenaryType mercenaryType, Vector3 position) { this.ConstructMercenary(mercenaryType, position, true); }
public void HireMercenary(MercenaryType type) { this.m_Products[type].HireMercenary(); }
public MercenaryProductLogicObject GetProductLogicObject(MercenaryType type) { return(this.m_Products[type]); }
public static int GetCurrentValueFromConfig(TaskConditionConfigData configData) { TaskConditionType conditionType = configData.ConditionType; switch (conditionType) { case TaskConditionType.ConstructBuildingCondition: { BuildingType type = (BuildingType)configData.Value1; int result = 0; List <BuildingLogicData> buildings = LogicController.Instance.GetBuildings(type); foreach (BuildingLogicData building in buildings) { if (building.Level != 0) { result++; } } return(result); } case TaskConditionType.DestroyBuildingCondition: { BuildingType type = (BuildingType)configData.Value1; return(LogicController.Instance.PlayerData.GetDestroyBuilding(type)); } case TaskConditionType.HonourCondition: { return(LogicController.Instance.PlayerData.Honour); } case TaskConditionType.PlunderCondition: { if ((int)configData.Value1 == 0) { return(LogicController.Instance.PlayerData.PlunderTotalGold); } else if ((int)configData.Value1 == 1) { return(LogicController.Instance.PlayerData.PlunderTotalFood); } else { return(LogicController.Instance.PlayerData.PlunderTotalOil); } } case TaskConditionType.ProduceArmyCondition: { ArmyType armyType = (ArmyType)configData.Value1; return(LogicController.Instance.PlayerData.GetProduceArmyCount(armyType)); } case TaskConditionType.RemoveObjectCondition: { return(LogicController.Instance.PlayerData.RemoveTotalObject); } case TaskConditionType.UpgradeArmyCondition: { ArmyType armyType = (ArmyType)configData.Value1; return(LogicController.Instance.PlayerData.GetArmyLevel(armyType)); } case TaskConditionType.UpgradeBuildingCondition: { BuildingType buildingType = (BuildingType)configData.Value1; List <BuildingLogicData> buildings = LogicController.Instance.GetBuildings(buildingType); int result = 0; foreach (BuildingLogicData building in buildings) { if (building.Level > result) { result = building.Level; } } return(result); } case TaskConditionType.HireMercenaryCondition: { MercenaryType mercenaryType = (MercenaryType)configData.Value1; return(LogicController.Instance.PlayerData.GetMercenaryStartNO(mercenaryType)); } default: return(0); } }
public MercenaryIdentity(MercenaryType type, int NO) { this.mercenaryType = type; this.mercenaryNO = NO; }
public void HireMercenary(MercenaryType type) { this.m_Data.ProduceMercenary.HireMercenary(type); }