// Update is called once per frame void Update() { //Determination of the positions and color of the arrow if (position != 0 && !minimapOn) //position None { positions = Environment2.GetRotationAndPositionOfArrow(player, objectsInGame[position]); } //Set color of the UI if (!minimapOn) { label.GetComponent <Text>().color = colorsOfObjects[position]; arrowS.GetComponent <Image>().color = colorsOfObjects[position]; } if (position != 0 && !minimapOn) //position None { //Set color of the UI arrow.GetComponent <SpriteRenderer>().color = colorsOfObjects[position]; //Change position of arrow arrow.transform.eulerAngles = new Vector3(0, 0, (float)positions[0]); arrow.transform.position = new Vector3(player.transform.position.x + (float)positions[1], player.transform.position.y + (float)positions[2], -1); } if (start) { minimapP.SetActive(false); start = false; } //If player click R, then objects changing. if (Input.GetKeyDown("r")) { player.GetComponent <AudioSource>().PlayOneShot(radarChangeSound); position++; if (position == objectsInGame.Count && minimap && minimapOn == false) { minimapOn = true; minimapP.SetActive(true); planetsMarker.SetActive(false); } else { if (position >= objectsInGame.Count || position == maxposition) { position = 0; minimapOn = false; minimapP.SetActive(false); planetsMarker.SetActive(true); } } if (position == 0 || minimapOn) { arrow.GetComponent <Renderer>().enabled = false; } else { arrow.GetComponent <Renderer>().enabled = true; } if (!minimapOn) { GameObject.Find("PlanetsMarker").GetComponent <Dropdown>().value = position; } } //When focused object is in the player view. if (position != 0 && !minimap) { if (objectsInGame[position].GetComponent <Renderer>().isVisible) { arrow.GetComponent <Renderer>().enabled = false; } else { arrow.GetComponent <Renderer>().enabled = true; } } }