// Use this for initialization private void Start() { //Setting the reference to our text component this.ourText = this.GetComponent <Text>(); //Setting the reference to the party WASD movement component this.partyMovement = PartyGroup.group1.GetComponent <WASDOverworldMovement>(); }
// Update is called once per frame private void Update() { //Getting the reference to the current player party WASDOverworldMovement partyMover = PartyGroup.globalReference.GetComponent <WASDOverworldMovement>(); //If the player is in combat or moving, the menu needs to be hidden if (!partyMover.IsPartyAtRest()) { //If we made it past the loop, there were no map locations on the current tile, so we disable the goToLocationButton this.goToLocationButton.SetActive(false); //Setting the playerTileLocation reference to null this.playerTileLocation = null; return; } //If the player party tile's decoration object is a map location if (partyMover.currentTile.decorationModel != null && partyMover.currentTile.decorationModel.GetComponent <MapLocation>()) { //We enable the goToLocationButton so that the player can travel there this.goToLocationButton.SetActive(true); //Setting the playerTileLocation reference this.playerTileLocation = partyMover.currentTile.decorationModel.GetComponent <MapLocation>(); //Displaying the location's name on the button this.buttonText.text = this.playerTileLocation.visitMessage + " " + this.playerTileLocation.locationName; //We also end this function so we don't keep looping for no reason return; } //If we made it past the loop, there were no map locations on the current tile, so we disable the goToLocationButton this.goToLocationButton.SetActive(false); //Setting the playerTileLocation reference to null this.playerTileLocation = null; }
// Use this for initialization private void Start() { //Getting the reference to our Image component this.ourImage = this.GetComponent <Image>(); //Getting the reference to the player group's WASDOverworldMovement.cs component this.partyMove = PartyGroup.group1.GetComponent <WASDOverworldMovement>(); //Setting our image sprite to the same image as the one the MiniMapUI.cs component created this.ourImage.sprite = this.miniMapRef.GetComponent <Image>().sprite; //Multiplying our sprite's size to scale it up so it fits the screen better this.GetComponent <RectTransform>().sizeDelta = this.GetComponent <RectTransform>().sizeDelta *this.spriteSizeMultiplier; }