public void Draw(ExplorationEvent currentEvent, ExploreState state) { gameObject.GetComponentInChildren <Text> ().text = currentEvent.description; for (int i = 0; i < currentEvent.options.Count; i++) { GameObject button = Instantiate(OptionButton, gameObject.transform.position, gameObject.transform.rotation) as GameObject; button.transform.SetParent(OptionPanel.transform); Text[] texts = button.GetComponentsInChildren <Text> (); texts[0].text = currentEvent.options [i].description; List <KeyValuePair <string, int> > list = currentEvent.options [i].probability(state.getParty()).ToList(); string odds = ""; foreach (KeyValuePair <string, int> pair in list) { odds += pair.Key + ": " + pair.Value + "\n"; } texts[1].text = odds; button.gameObject.GetComponent <OptionButtonBehavior> ().optionNum = i; button.gameObject.GetComponent <OptionButtonBehavior> ().state = state; button.GetComponent <Button>().interactable = currentEvent.options[i].checkSpecialRequirements(state.getParty()); } this.gameObject.transform.position = GameManager.Instance.transform.position; this.gameObject.SetActive(true); }
public void Results(Reward reward, ExploreState state) { if (reward == null) { reward = new RewardImpl.DoNothingReward("You found poor tuning, nothing happens."); } gameObject.GetComponentInChildren <Text>().text = reward.ToString(); GameObject goHomeButton = Instantiate(OptionButton, gameObject.transform.position, gameObject.transform.rotation) as GameObject; goHomeButton.transform.SetParent(OptionPanel.transform); goHomeButton.GetComponentInChildren <Text>().text = "Go Home"; goHomeButton.gameObject.GetComponent <OptionButtonBehavior>().optionNum = 0; goHomeButton.gameObject.GetComponent <OptionButtonBehavior>().state = state; GameObject continueButton = Instantiate(OptionButton, gameObject.transform.position, gameObject.transform.rotation) as GameObject; continueButton.transform.SetParent(OptionPanel.transform); continueButton.GetComponentInChildren <Text>().text = "Continue"; continueButton.gameObject.GetComponent <OptionButtonBehavior>().optionNum = 1; continueButton.gameObject.GetComponent <OptionButtonBehavior>().state = state; this.gameObject.transform.position = GameManager.Instance.transform.position; this.gameObject.SetActive(true); }
internal void goExplore(ExploreRegion region) { ExploreState exploreState = new ExploreState(); exploreState.StartExploration(worldState, region); activeState = exploreState; MyEventSystem.AdvanceSeasons(); }
// Use this for initialization void Start() { _agent = GetComponent <NavMeshAgent>(); // Room manager var gm = GameObject.FindGameObjectWithTag(Constants.Tags.GameMaster); if (gm == null || gm.GetComponent <RoomManager>() == null) { throw new Exception("We need a RoomManager in the scene, for the AI to work..!"); } _rm = gm.GetComponent <RoomManager>(); _rm.Ai = this; _exploreState = new ExploreState(_agent, StrollSpeed) { Waypoints = _rm.GetCurrnetWaypoints() }; StartCoroutine(StateExecuter()); }