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); } }
public void OpenTravellersReporterTab(BaseTravellerBehavior thisTraveller) { if (travellersTab.isShowing) { return; } travellersTab.gameObject.SetActive(true); travellersTab.ShowTravellerReport(thisTraveller); }
public void ShowTravellerReport(BaseTravellerBehavior thisTraveller) { EventBroadcaster.Instance.PostEvent(EventNames.HIDE_RESOURCES); EventBroadcaster.Instance.PostEvent(EventNames.ENABLE_TAB_COVER); ResourceInformationController.GetInstance.ShowResourcePanel(ResourcePanelType.side); StartCoroutine(myPanel.WaitAnimationForAction(myPanel.openAnimationName, SetupActionReport)); travellerClicked = thisTraveller.gameObject; currentTravellerReport = thisTraveller; isShowing = true; unitRectPos = Camera.main.WorldToScreenPoint(thisTraveller.transform.position); myRect.position = unitRectPos; isTransitioning = true; InitializeTravellerReport(); }
public void ResetTravellerReport() { if (actionList != null && actionList.Count > 0) { for (int i = 0; i < actionList.Count; i++) { DestroyImmediate(actionList[i].gameObject); } actionList.Clear(); } noActionsTaken.SetActive(true); for (int i = 0; i < unitsIconHandler.unitsIcons.Count; i++) { unitsIconHandler.ShowIcon(i); unitsIconHandler.SetAsUnknownIcon(i); } currentTravellerReport = null; }
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(); } } }
public void StartBalconyTutorial(bool fromCreationScene) { List <DialogueIndexReaction> callBacks = new List <DialogueIndexReaction>(); DialogueIndexReaction temp0 = new DialogueIndexReaction(); temp0.dialogueIndex = 1; temp0.potentialCallback = () => DialogueManager.GetInstance.MovePanelUp(); DialogueIndexReaction temp1 = new DialogueIndexReaction(); temp1.dialogueIndex = 2; temp1.potentialCallback = () => ShowBarracksTutorial(); DialogueIndexReaction temp2 = new DialogueIndexReaction(); temp2.dialogueIndex = 5; temp2.potentialCallback = () => ShowFarmTutorial(); DialogueIndexReaction temp3 = new DialogueIndexReaction(); temp3.dialogueIndex = 9; temp3.potentialCallback = () => ShowTavernTutorial(); temp3.moveDialogueUp = true; DialogueIndexReaction temp4 = new DialogueIndexReaction(); temp4.dialogueIndex = 13; temp4.potentialCallback = () => ShowShopTutorial(); DialogueIndexReaction temp5 = new DialogueIndexReaction(); temp5.dialogueIndex = 17; temp5.potentialCallback = () => ShowBlacksmithTutorial(); DialogueIndexReaction temp6 = new DialogueIndexReaction(); temp6.dialogueIndex = 20; temp6.potentialCallback = () => ShowTravelTutorial(); temp6.moveDialogueDown = true; DialogueIndexReaction temp7 = new DialogueIndexReaction(); temp7.dialogueIndex = 23; temp7.potentialCallback = () => ShowHousingTutorial(); DialogueIndexReaction temp8 = new DialogueIndexReaction(); temp8.dialogueIndex = 27; temp8.potentialCallback = () => ShowMarketTutorial(); temp8.moveDialogueUp = true; callBacks.Add(temp0); callBacks.Add(temp1); callBacks.Add(temp2); callBacks.Add(temp3); callBacks.Add(temp4); callBacks.Add(temp5); callBacks.Add(temp6); callBacks.Add(temp7); callBacks.Add(temp8); if (TransitionManager.GetInstance != null) { TransitionManager.GetInstance.HideTabCover(); } if (DialogueManager.GetInstance != null) { if (fromCreationScene) { // Summon Monster BalconySceneManager.GetInstance.travelSystem.SummonRandomTraveller(TravelLocation.ForestOfRetsnom, TravellerType.Invader, 20); // 20 prologueBandit = BalconySceneManager.GetInstance.travelSystem.spawnedUnits[BalconySceneManager.GetInstance.travelSystem.spawnedUnits.Count - 1]; prologueBandit.clickDetector.isClickable = false; } else { // Optional : You might be able to use this part in case you want to 're-run' the tutorial // post-creation } ConversationInformationData tmp = DialogueManager.GetInstance.dialogueStorage.ObtainConversationByTitle("Introduce the buildings"); Debug.Log("[STARTING CONVERSATION] Introduce the buildings"); DialogueManager.GetInstance.StartConversation(tmp, HideAllTutorial, callBacks); } }