Exemplo n.º 1
0
    public void GenerateMercenaryInCamp(MercenaryType mercenaryType, IBuildingInfo campInfo)
    {
        GameObject mercenary = this.GenerateMercenary(mercenaryType);
        ArmyAI     ai        = mercenary.GetComponent <ArmyAI>();

        ai.GenerateArmyInCamp(campInfo);
    }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public int GetMercenaryStartNO(MercenaryType type)
 {
     if (!this.m_UserData.MercenaryProgress.ContainsKey(type))
     {
         return(0);
     }
     return(this.m_UserData.MercenaryProgress[type]);
 }
Exemplo n.º 4
0
 public override void OnHireMercenary(MercenaryType mercenaryType)
 {
     if (mercenaryType == this.m_MercenaryType)
     {
         this.CurrentValue++;
         this.IsComplete = (this.Progress >= this.m_Count);
     }
 }
Exemplo n.º 5
0
 public void OnHireMercenary(MercenaryType mercenaryType)
 {
     foreach (Task task in this.m_TaskList)
     {
         if (task.Status == TaskStatus.Opened)
         {
             task.OnHireMercenary(mercenaryType);
         }
     }
 }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
    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();
        }
    }
Exemplo n.º 11
0
    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);
    }
Exemplo n.º 12
0
    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);
    }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
    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);
                }
            }
        }
    }
Exemplo n.º 15
0
 public virtual void OnHireMercenary(MercenaryType mercenaryType)
 {
 }
Exemplo n.º 16
0
 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]);
 }
Exemplo n.º 17
0
	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;
	}
Exemplo n.º 18
0
 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;
 }
Exemplo n.º 20
0
 public int GetMercenaryOrder(MercenaryType mercenaryType)
 {
     return(this.m_MercenaryOrders[mercenaryType]);
 }
Exemplo n.º 21
0
    public GameObject GetMercenaryPrefab(MercenaryType mercenaryType)
    {
        GameObject result = this.m_PreloadMercenaryPrefab[mercenaryType];

        return(result);
    }
Exemplo n.º 22
0
 public void ConstructMercenary(MercenaryType mercenaryType, Vector3 position)
 {
     this.ConstructMercenary(mercenaryType, position, true);
 }
Exemplo n.º 23
0
 public void HireMercenary(MercenaryType type)
 {
     this.m_Products[type].HireMercenary();
 }
Exemplo n.º 24
0
 public MercenaryProductLogicObject GetProductLogicObject(MercenaryType type)
 {
     return(this.m_Products[type]);
 }
Exemplo n.º 25
0
    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);
        }
    }
Exemplo n.º 26
0
 public MercenaryIdentity(MercenaryType type, int NO)
 {
     this.mercenaryType = type;
     this.mercenaryNO   = NO;
 }
Exemplo n.º 27
0
 public void HireMercenary(MercenaryType type)
 {
     this.m_Data.ProduceMercenary.HireMercenary(type);
 }