示例#1
0
        public List <TroopsInformation> GenerateBasicWarband(int unitCount)
        {
            List <int> troopTypes = new List <int>();

            troopTypes.Add(0);
            troopTypes.Add(0);
            troopTypes.Add(0);
            troopTypes.Add(0);

            for (int i = 0; i < unitCount; i++)
            {
                int rand = UnityEngine.Random.Range(0, troopTypes.Count);
                troopTypes[rand] += 1;
            }

            TroopsInformation recruit   = TroopsInformation.ConvertToTroopsInformation(GetUnitInformation("Recruit"), troopTypes[0]);
            TroopsInformation swordsman = TroopsInformation.ConvertToTroopsInformation(GetUnitInformation("Swordsman"), troopTypes[1]);
            TroopsInformation spearman  = TroopsInformation.ConvertToTroopsInformation(GetUnitInformation("Spearman"), troopTypes[2]);
            TroopsInformation archer    = TroopsInformation.ConvertToTroopsInformation(GetUnitInformation("Archer"), troopTypes[3]);

            List <TroopsInformation> tmp = new List <TroopsInformation>();

            tmp.Add(recruit);
            tmp.Add(swordsman);
            tmp.Add(spearman);
            tmp.Add(archer);

            return(tmp);
        }
        public void RecruitTroops()
        {
            if (curPlayer.coins < GetRecruitCoins && curPlayer.population < 1)
            {
                Debug.LogWarning("Trying to recruit a troop but you seem to be lacking in resources [ Coins:" + curPlayer.coins + "] [Pop:" + curPlayer.population + "]");
                return;
            }

            curPlayer.coins -= GetRecruitCoins;
            curPlayer.SetPopulation(-1);

            int idx = -1;

            if (curPlayer.troopsList == null)
            {
                curPlayer.troopsList = new List <TroopsInformation>();
            }
            if (curPlayer.troopsList.Find(x => x.unitInformation.unitName == "Recruit") != null)
            {
                idx = curPlayer.troopsList.FindIndex(x => x.unitInformation.unitName == "Recruit");
            }

            if (idx != -1)
            {
                curPlayer.troopsList[idx].totalUnitCount += 1;
            }
            else
            {
                curPlayer.troopsList.Add(TroopsInformation.ConvertToTroopsInformation(TransitionManager.GetInstance.unitStorage.GetUnitInformation("Recruit"), 0));
                curPlayer.troopsList[curPlayer.troopsList.Count - 1].totalUnitCount += 1;
            }
        }
        public BaseTravellerData GenerateRandomWarbandTraveller(int unitCount, float newRelationship)
        {
            BaseTravellerData tmp = new BaseTravellerData();

            tmp.weekSpawned   = ObtainPlayerWeeklyCount();
            tmp.troopsCarried = new List <TroopsInformation>();

            if (newRelationship < 0)
            {
                tmp.affiliatedTeam = Maps.TerritoryOwners.FurKhan;
            }
            else
            {
                tmp.affiliatedTeam = Maps.TerritoryOwners.Neutral;
            }

            int randLdrIdx = UnityEngine.Random.Range(0, unitStorage.heroStorage.Count);

            tmp.leaderUnit = new List <BaseHeroInformationData>();
            BaseHeroInformationData newLeader = new BaseHeroInformationData();

            newLeader = TransitionManager.GetInstance.unitStorage.ObtainHeroBaseInformation(WieldedWeapon.Bow);

            // TODO : CHANGE ON NEW HERO PREFABS
            newLeader.unitInformation.prefabDataPath = "Assets/Resources/Prefabs/Unit and Items/Player.prefab";
            tmp.leaderUnit.Add(newLeader);
            tmp.UpdateRelationship(newRelationship);

            // TroopTypes
            List <int> troopTypes = new List <int>();

            troopTypes.Add(0);
            troopTypes.Add(0);
            troopTypes.Add(0);
            troopTypes.Add(0);

            for (int i = 0; i < unitCount; i++)
            {
                int rand = UnityEngine.Random.Range(0, troopTypes.Count);
                troopTypes[rand] += 1;
            }


            TroopsInformation recruit   = TroopsInformation.ConvertToTroopsInformation(unitStorage.GetUnitInformation("Recruit"), troopTypes[0]);
            TroopsInformation swordsman = TroopsInformation.ConvertToTroopsInformation(unitStorage.GetUnitInformation("Swordsman"), troopTypes[1]);
            TroopsInformation spearman  = TroopsInformation.ConvertToTroopsInformation(unitStorage.GetUnitInformation("Spearman"), troopTypes[2]);
            TroopsInformation archer    = TroopsInformation.ConvertToTroopsInformation(unitStorage.GetUnitInformation("Archer"), troopTypes[3]);

            tmp.troopsCarried.Add(recruit);
            tmp.troopsCarried.Add(swordsman);
            tmp.troopsCarried.Add(spearman);
            tmp.troopsCarried.Add(archer);

            TravellerFlavourPhrase flavourTmp = new TravellerFlavourPhrase();

            flavourTmp.relationshipGauge = -50;
            flavourTmp.flavourText       = "100 coins is not enough, we know you're hiding more there!";

            TravellerFlavourPhrase flavourTmp1 = new TravellerFlavourPhrase();

            flavourTmp1.relationshipGauge = -30;
            flavourTmp1.flavourText       = "100 coins, you should give more!";

            TravellerFlavourPhrase flavourTmp2 = new TravellerFlavourPhrase();

            flavourTmp2.relationshipGauge = 0;
            flavourTmp2.flavourText       = "100 coins might make us stay a week or two..";

            tmp.flavourTexts = new List <TravellerFlavourPhrase>();
            tmp.flavourTexts.Add(flavourTmp);
            tmp.flavourTexts.Add(flavourTmp1);
            tmp.flavourTexts.Add(flavourTmp2);
            return(tmp);
        }