Ejemplo n.º 1
0
        public void SummonSpecificTraveller(BaseTravellerData travellerData, bool newSummon = true)
        {
            ScenePointBehavior spawnPoint = TransitionManager.GetInstance.currentSceneManager.ObtainScenePoint(travellerData.currentScenePoint);

            GameObject tmp = null;

            tmp = GameObject.Instantiate(basicInvaderPrefab, spawnPoint.transform.position, Quaternion.identity, null);

            BaseTravellerBehavior temp = tmp.GetComponent <BaseTravellerBehavior>();

            temp.myTravellerData = new BaseTravellerData();
            temp.myTravellerData = travellerData;

            temp.armyMovement.SetPosition(spawnPoint, true);

            //ScenePointBehavior targetPoint = ScenePointPathfinder.GetInstance.ObtainNearestScenePoint(travellerData.TargetPosition());
            //temp.TravelMovement(targetPoint);

            spawnedUnits.Add(temp);
            CheckRelationship(travellerData.relationship, true);

            if (newSummon)
            {
                if (TransitionManager.GetInstance != null && !TransitionManager.GetInstance.isNewGame)
                {
                    if (PlayerGameManager.GetInstance != null)
                    {
                        PlayerGameManager.GetInstance.SaveTraveller(travellerData);
                        SaveData.SaveLoadManager.GetInstance.SaveCurrentCampaignData();
                    }
                }
                temp.TravelMovement(frontGate);
            }
        }
Ejemplo n.º 2
0
        public BaseTravellerData GenerateRandomMerchantTraveller(int unitCount, float newRelationship)
        {
            BaseTravellerData tmp = new BaseTravellerData();

            // INITIALIZATION OF DATA
            tmp.weekSpawned   = ObtainPlayerWeeklyCount();
            tmp.troopsCarried = new List <TroopsInformation>();

            // LEADER INFORMATION
            int randLdrIdx = UnityEngine.Random.Range(0, unitStorage.merchantStorage.Count);

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

            BaseHeroInformationData newLeader = new BaseHeroInformationData();

            newLeader.unitInformation = new UnitInformationData();
            newLeader = TransitionManager.GetInstance.unitStorage.ObtainHeroBaseInformation(WieldedWeapon.Bow);
            // TODO : CHANGE ON NEW HERO PREFABS
            newLeader.unitInformation.prefabDataPath = "Assets/Resources/Prefabs/Unit and Items/Player.prefab";
            newLeader.unitInformation.wieldedWeapon  = WieldedWeapon.Bow;


            tmp.leaderUnit.Add(newLeader);
            tmp.UpdateRelationship(newRelationship);
            // TRAVELLER SPEED
            tmp.travellerSpeed = 0.025f;


            // TROOPS CARRIED
            tmp.troopsCarried.AddRange(unitStorage.GenerateBasicWarband(unitCount));

            TravellerFlavourPhrase flavourTmp = new TravellerFlavourPhrase();

            flavourTmp.relationshipGauge = 0;
            flavourTmp.flavourText       = "We're here to make some profits!";

            tmp.flavourTexts = new List <TravellerFlavourPhrase>();
            tmp.flavourTexts.Add(flavourTmp);

            return(tmp);
        }
Ejemplo n.º 3
0
        public void SummonRandomTraveller(TravelLocation startingPoint, TravellerType travellerType, int unitCount)
        {
            ScenePointBehavior spawnPoint    = ObtainSpawnPoint(startingPoint);
            BaseTravellerData  travellerData = new BaseTravellerData();
            GameObject         tmp           = null;

            tmp = GameObject.Instantiate(basicInvaderPrefab, spawnPoint.transform.position, Quaternion.identity, null);


            int rand = UnityEngine.Random.Range(0, 100);

            switch (travellerType)
            {
            case TravellerType.Invader:
                travellerData = travellerGenerator.GenerateRandomWarbandTraveller(unitCount, -100);
                travellerData.travellersName = "Sweet Bandits" + rand.ToString();     // Create a name generator
                break;

            case TravellerType.Merchant:
                travellerData = travellerGenerator.GenerateRandomMerchantTraveller(unitCount, 0);
                travellerData.travellersName = "Merchant of " + rand.ToString();     // Create a name generator
                break;

            case TravellerType.Hero:
                break;

            case TravellerType.Warband:
                travellerData = travellerGenerator.GenerateRandomWarbandTraveller(unitCount, 0);
                travellerData.travellersName = "Mercenary " + rand.ToString();
                break;

            default:
                break;
            }

            // Positions and Target locations
            travellerData.originalSpawnPoint      = spawnPoint.gameObject.name;
            travellerData.currentScenePoint       = spawnPoint.gameObject.name;
            travellerData.currentSceneTargetPoint = frontGate.gameObject.name;

            BaseTravellerBehavior inv = tmp.GetComponent <BaseTravellerBehavior>();

            inv.InitializeSpawnInvasion(travellerData);
            inv.armyMovement.SetPosition(spawnPoint, true);
            inv.TravelMovement(frontGate);

            if (spawnedUnits == null)
            {
                spawnedUnits = new List <BaseTravellerBehavior>();
            }

            spawnedUnits.Add(inv);
            CheckRelationship(travellerData.relationship);

            if (TransitionManager.GetInstance != null && !TransitionManager.GetInstance.isNewGame)
            {
                if (PlayerGameManager.GetInstance != null)
                {
                    PlayerGameManager.GetInstance.SaveTraveller(travellerData);
                    SaveData.SaveLoadManager.GetInstance.SaveCurrentCampaignData();
                }
            }
        }
Ejemplo n.º 4
0
        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);
        }