Jump to content
Unity Insider Forum

Ashrag

Members
  • Gesamte Inhalte

    13
  • Benutzer seit

  • Letzter Besuch

Letzte Besucher des Profils

Der "Letzte Profil-Besucher"-Block ist deaktiviert und wird anderen Benutzern nicht angezeit.

Ashrag's Achievements

Member

Member (2/3)

0

Ansehen in der Community

  1. Ashrag

    inGame Shop und Materials

    Guten Abend zusammen, ich habe eine weitere Frage und bin schon sehr dankbar über die Hilfe meines letztens Problem. Mit jedem Problem was ich habe und löschen kann, alleine oder mit Hilfe, hilft mir mehr und mehr Unity und C# zu verstehen. Mein jetziges Problem ist, ich würde gern Materials in einem GameObject durch einen Shop ändern. Ich denke das Funktioniert hier ganz gut mit GameObject.FindWithTag("Platform"), da die Quelle für den PlatformSpawner nicht in der Scene ist, sondern ein Prefab. Oder wäre das schon ein Grund, warum es mit FindWithTag nicht funktionieren könnte? Die zwei Skripte, damit eine kleine Übersicht da ist, wo es um das Spawnen geht und das Hauptskript PlatformSpawner: using UnityEngine; using System.Collections; public class PlatformSpawner : MonoBehaviour { public GameObject Platform; // Es wird in der UI ein Feld erzeugt, wo wir die Platform Prefabs reinziehen können, diese soll erzeugt werden. public GameObject diamonds; Vector3 lastPos; float size; public bool gameOver; // Use this for initialization void Start() { lastPos = Platform.transform.position; size = Platform.transform.localScale.x; for (int i = 0; i < 20; i++) // Die "FOR"-Schleife wird solange ausgeführt bis es 5 Platformen sind, also werden 5 Platformen erzeugt { SpawnPlatforms(); } } public void StartSpawningPlatforms() { InvokeRepeating("SpawnPlatforms", 0.1f, 0.2f); // "InvokeRepeating" führt nach 2 Sekunden alle 0.2 Sekunden die Funktion SpawnPlatforms aus } // Update is called once per frame void Update() { if (GameManager.instance.gameOver == true) { CancelInvoke("SpawnPlatforms"); // nachdem GameOver ist, werden keine neuen Platformen mehr gespawnt } } void SpawnPlatforms() // Durch diese Funktion wird durch Zufall bestimmt wie viele Platformen in X und Z Achsen erzeugt werden. { // if (gameOver) // { // ist auch eine Möglichkeit für Stop von Spawn neuer Platforms nach Gameover ** CancelInvoke wurde später hinzugefügt ** // return; // } int rand = Random.Range(0, 6); if (rand < 3) { SpawnX(); } else if(rand >=3) { SpawnZ(); } } void SpawnX() { Vector3 pos = lastPos; // Es wird temporär der Wert von "lastPos" übergeben pos.x += size; // es wird eine Platform in der X-Achse erreichtet mit der Size, die oben definiert wude lastPos = pos; // "pos" hat eine Position bekommen und übergibt den Wert an "lastPos", somit kann immer die aktuelle Position übergeben werden für die neue Platform Instantiate(Platform, pos, Quaternion.identity); int rand = Random.Range(0, 4); // Es wird ein Random generator erzeugt zwischen 0 und 4 if(rand < 1) // sollte die Zahl kleiner 1 sein, also 0, wird ein Diamond gespawnt { Instantiate(diamonds, new Vector3(pos.x,pos.y + 1.3f, pos.z), diamonds.transform.rotation ); // der New Vector ist dafür da, dass die Diamonds über der Platform sind und die rotation, dass die die 45° rotation nehmen } } void SpawnZ() { Vector3 pos = lastPos; // Es wird temporär der Wert von "lastPos" übergeben pos.z += size; // es wird eine Platform in der Z-Achse erreichtet mit der Size, die oben definiert wude lastPos = pos; // "pos" hat eine Position bekommen und übergibt den Wert an "lastPos", somit kann immer die aktuelle Position übergeben werden für die neue Platform Instantiate(Platform, pos, Quaternion.identity); int rand = Random.Range(0, 4); if (rand < 1) { Instantiate(diamonds, new Vector3(pos.x, pos.y + 1.3f, pos.z), diamonds.transform.rotation); } } } Und das große Skript, es sieht etwas unübersichtlich aus, weil ich schon viel getestet habe und es auch noch andere überreste gibt. Ich müsste es mal aufräumen. UiManager: using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement; using System; public class UiManager : MonoBehaviour { public static UiManager instance; public GameObject zigzagPanel; // Erstellt Felder in der GUI public GameObject gameOverPanel; public GameObject shopCanves; public GameObject shopOpen; public GameObject shopClose; public GameObject colorBallTab; public GameObject bModelsTab; public GameObject platformTab; public GameObject platModelTab; public GameObject tapText; public GameObject leaderBoardButton; public GameObject AchievmentButton; public GameObject ScoreCount; public GameObject DCounter; public GameObject ButtonAds; //public GameObject colorBuySetText; public CameraFollow cameraSkript; // Rate Button Links public string ANDROID_RATE_URL = "market://details?id=com.SolAppGames.ZigZagDiS"; public string IOS_RATE_URL = "itms_apps://itunes.apple.com/app/idcom.SolAppGames.ZigZagDiS"; //public Text ScoreC; public Text score; public Text highScore1; public Text highScore2; public Text DiamondsCounter; // // Shop-Einstellungen // // // Der Text wird später verwendet um ihn dynamisch zu machen // public Text colorBuySetText; public Text bModelBuySetText; public Text pModelBuySetText; public Text platModelBuySetText; //public Text diamondText; // für den Fall, das die Diamantenanzeige in den Shop soll || in Start Funktion und eigene UpdateDiamondsText() Funktion // // Durch einfügen der Panel wird es später möglich den Inhalt der Panels(Child) zu verändern // public Transform colorPanel; public Transform bModelPanel; public Transform pModelPanel; public Transform platModelPanel; // // Preisliste der einzelnen Items // private int[] colorCost = new int[] { 0, 500, 500, 500, 500, 500, 500, 500, 500, 500 }; private int[] ballsCost = new int[] { 0, 2000, 2000, 2000, 2000, 2000, 2000, 2000, 2500 }; private int[] platformsCost = new int[] { 0, 750, 750, 750, 750, 750, 750, 750, 750 }; private int[] platModelCost = new int[] { 0, 2250, 2250, 2250, 2250, 2250, 2250, 2250, 2750 }; // // Selektiert und Aktiviert das ausgewählte Item // private int selectedColorIndex; private int selectedBallsIndex; private int selectedPlatformsIndex; private int selectedPlatModelIndex; private int activeColorIndex; private int activeBallsIndex; private int activePlatformsIndex; private int activePlatModelIndex; // // Hier wird das aktuelle Material (Farbe des Item) rein getan // private GameObject currentBall; public GameObject currentBallPrefab; public Mesh ballMesh; public Material ballMaterial; public Material platformMaterial; public Material platModelMaterial; // // Dieses Array wird verwendet, um später zwischen den Farben und Modellen zu wählen. // public Color[] ballColor = new Color[10]; public Color[] platformColor = new Color[9]; public GameObject[] playerBalls = new GameObject[9]; public Material[] platModel = new Material[9]; Renderer rend; // Ende Shop-Einstellungen // // // // Testing // //public GameObject m_ParentObject; //public GameObject m_ChildObject; //public GameObject bModel2; //public GameObject bModel3; //public GameObject bModel4; //public GameObject bModel5; //public GameObject bModel6; //public GameObject bModel7; //public GameObject bModel8; //Use this for getting the toggle data bool m_ActivateParent, m_ActivateChild; //Use these for deciding if console is needing updated bool m_HierarchyOutput, m_SelfOutput; void Awake() { if (instance == null) { instance = this; } } // // Use this for initialization // void Start() { highScore1.text = "High Score: " + PlayerPrefs.GetInt("highScore"); DiamondsCounter.text = "" + PlayerPrefs.GetInt("dholder"); // beim Start der App werden auf die Speicherdaten zugegriffen und Angezeigt // Shop Funktionen InitShop(); SaveManager.Instance.state.diamonds = PlayerPrefs.GetInt("dholder"); // Überträgt die Diamanten in die Save Datei! Muss ggf. auch in die Updatefunktion! // // Set Ball's preferences (color) // OnColorSelect(SaveManager.Instance.state.activeColor); SetColor(SaveManager.Instance.state.activeColor); OnBModelSelect(SaveManager.Instance.state.activeBalls); SetBalls(SaveManager.Instance.state.activeBalls); OnBPlatformSelect(SaveManager.Instance.state.activePlatforms); SetPlatforms(SaveManager.Instance.state.activePlatforms); // // Make the buttons bigger for the selected items // colorPanel.GetChild(SaveManager.Instance.state.activeColor).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; bModelPanel.GetChild(SaveManager.Instance.state.activeBalls).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; pModelPanel.GetChild(SaveManager.Instance.state.activePlatforms).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; // // Renderer für Platform // rend = GetComponent<Renderer>(); rend.enabled = true; //rend.sharedMaterial = platModel[index]; // UpdateDiamondsText(); // wird benötigt um den Diamanten Text im Shop anzuzeigen // // Testing // //Deactivate parent and child GameObjects and toggles //m_ActivateParent = false; //m_ActivateChild = false; ////Ables script to output current state of GameObject to console //m_HierarchyOutput = false; //m_SelfOutput = false; } public void GameStart() // In die Funktion kommt alles für den Game start rein { tapText.SetActive(false); // tapText wird unsichtbar, wenn das Game startet shopCanves.SetActive(false); shopOpen.SetActive(false); leaderBoardButton.SetActive(false); AchievmentButton.SetActive(false); ButtonAds.SetActive(false); ScoreCount.SetActive(true); DCounter.SetActive(false); //ScoreC.text = "Score: " + ScoreManager.instance.ScoreC ; //ScoreC.text = PlayerPrefs.GetInt("score").ToString(); zigzagPanel.GetComponent<Animator>().Play("panelUp"); // startet die Animation vom zigzagpanel -> Der name muss genau übereinstimmen was im Animator steht. } public void GameOver() // In die Funktion kommt alles rein, wenn es das GameOver betrifft { score.text = PlayerPrefs.GetInt("score").ToString(); highScore2.text = PlayerPrefs.GetInt("highScore").ToString(); gameOverPanel.SetActive(true); ScoreCount.SetActive(false); } public void Reset() { SceneManager.LoadScene(0); } public void ShowLeaderBoard() { LeaderBoardManager.instance.ShowLeaderBoard(); } public void ShowAchievements() { AchievmentManager.instance.ShowAchievments(); } //public void Login() //{ // SingIn.instance.Login(); //} // Update is called once per frame void Update() { DiamondsCounter.text = "" + PlayerPrefs.GetInt("dholder"); // Hier werden die Diamanten Punkte immer aktualisiert, ist nötig für die 10 Extra Diamanten für Werbung schauen // // Testing // ////Activates the GameObject you attach depending on the toggle output //m_ParentObject.SetActive(m_ActivateParent); //m_ChildObject.SetActive(m_ActivateChild); ////Find out if the GameObject is active in the Game and checks if this state has been output to the console //if (m_HierarchyOutput == false) //{ // //Output the state of the GameObject’s activity if it hasn't already been output // Debug.Log("Object Active : " + m_ChildObject.activeInHierarchy); // //The state of the GameObject is output already, so no need to do it again // m_HierarchyOutput = true; //} ////Check to see if the assigned GameObject is active despite parent GameObject's status //if (m_ChildObject.activeSelf && m_SelfOutput == false) //{ // //Output the message if the GameObject is still active // Debug.Log("Child Active, parent might not be"); // //You no longer need to output the message // m_SelfOutput = true; //} } // Rate Button public void RateButton() { #if UNITY_ANDROID Application.OpenURL(ANDROID_RATE_URL); Debug.Log("Button successful"); #elif UNITY_IPHONE Application.OpenURL(IOS_RATE_URL); #endif // Links.instance.RateButton(); } // Shop Funktionen / Tabs / Button public void ShopButton() { shopCanves.SetActive(true); // wird der Shop sichtbar gemacht colorBallTab.SetActive(true); AchievmentButton.SetActive(false); leaderBoardButton.SetActive(false); bModelsTab.SetActive(false); platformTab.SetActive(false); platModelTab.SetActive(false); //shopOpen.SetActive(false); } public void ShopClose() { shopCanves.SetActive(false); // wird der Shop ausgeblendet AchievmentButton.SetActive(true); leaderBoardButton.SetActive(true); //shopOpen.SetActive(true); } public void ShopBColor() // Öffnet den Ball Model Tab { colorBallTab.SetActive(true); bModelsTab.SetActive(false); platformTab.SetActive(false); platModelTab.SetActive(false); } public void ShopBModels() // Öffnet den Ball Model Tab { colorBallTab.SetActive(false); bModelsTab.SetActive(true); platformTab.SetActive(false); platModelTab.SetActive(false); } public void ShopPlatforms() // // Öffnet den Platform Model Tab { colorBallTab.SetActive(false); bModelsTab.SetActive(false); platformTab.SetActive(true); platModelTab.SetActive(false); } public void ShopPlatModel() // // Öffnet den Platform Model Tab { colorBallTab.SetActive(false); bModelsTab.SetActive(false); platformTab.SetActive(false); platModelTab.SetActive(true); } //public void OnColorBuySet() //{ // ShopController.instance.OnColorBuySet(); //} // // Shop Einstellungen Kaufen und Selecten // private void SetColor(int index) { activeColorIndex = index; // Set the active index SaveManager.Instance.state.activeColor = index; ballMaterial.color = ShopController.Instance.ballColor[index]; // Change the color on the ball model colorBuySetText.text = "Current"; // Change buy/set button text // Remember preferences SaveManager.Instance.Save(); } private void SetBalls(int index) { //activeBallsIndex = index; // Set the active index //SaveManager.Instance.state.activeBalls = index; //// = playerBalls[index].GetComponent<MeshFilter>().sharedMesh; // Change the color on the ball model ////playerBalls[index].GetComponent<MeshFilter>().mesh = ballMesh; //currentBallPrefab = playerBalls[index]; //bModelBuySetText.text = "Current"; // Change buy/set button text //// Remember preferences //SaveManager.Instance.Save(); activeBallsIndex = index; // Set the active index SaveManager.Instance.state.activeBalls = index; // Erst alle Bälle in der Szene deaktivieren foreach (GameObject ball in playerBalls) { ball.SetActive(false); } // Nun den aktuell ausgewählten Ball aktivieren playerBalls[index].SetActive(true); cameraSkript.ball = playerBalls[index]; // Aktuellen Ball dem Kameraskript zuweisen bModelBuySetText.text = "Current"; // Change buy/set button text // Remember preferences SaveManager.Instance.Save(); } private void SetPlatforms(int index) { activePlatformsIndex = index; // Set the active index SaveManager.Instance.state.activePlatforms = index; platformMaterial.color = platformColor[index]; // Change the color on the ball model pModelBuySetText.text = "Current"; // Change buy/set button text // Remember preferences SaveManager.Instance.Save(); } private void SetPlatModel(int index) { activePlatModelIndex = index; // Set the active index SaveManager.Instance.state.activePlatModel = index; rend = GetComponent<Renderer>(); rend.enabled = true; rend.sharedMaterial = platModel[index]; platModelMaterial = platModel[index]; // Change the color on the ball model platModelBuySetText.text = "Current"; // Change buy/set button text // Remember preferences SaveManager.Instance.Save(); } // // Shop wird aufgerufen! // private void InitShop() { //Just make sure we've assigned the references - Sicher stellen, dass wir die Referenzen zugewiesen haben if (colorPanel == null || bModelPanel == null || pModelPanel == null) Debug.Log("You did not asign the color panel in the inspector"); //For every children transform under our color panel, find the button and add onclick - Für alle Kinder, die unter unserem Farbfeld transformiert werden, finden Sie den Button und fügen einen Klick hinzu int i = 0; foreach (Transform t in colorPanel) { int currentIndex = i; Button b = t.GetComponent<Button>(); b.onClick.AddListener(() => OnColorSelect(currentIndex)); Image img = t.GetComponent<Image>(); //Set color of the image, based on if owned or not img.color = SaveManager.Instance.IsColorOwned(i) ? ballColor[currentIndex] : Color.Lerp(ballColor[currentIndex], new Color(0, 0, 0, 1), 0.25f); //currentBall.GetComponent<MeshFilter>().mesh = ballMesh; i++; } //Reset index; i = 0; // Do the same for the Model Panal & Platform Panal foreach (Transform t in bModelPanel) { int currentIndex = i; Button b = t.GetComponent<Button>(); b.onClick.AddListener(() => OnBModelSelect(currentIndex)); Image img = t.GetComponent<Image>(); //Set color of the image, based on if owned or not //img.color = SaveManager.Instance.IsColorOwned(i) ? ballColor[currentIndex] : Color.Lerp(ballColor[currentIndex], new Color(0, 0, 0, 1), 0.25f); img.color = SaveManager.Instance.IsBallsOwned(i) ? Color.white : new Color(0.7f, 0.7f, 0.7f); //t.SetActive(false); i++; } //Reset Index; i = 0; // Platform Panal foreach (Transform t in pModelPanel) { int currentIndex = i; Button b = t.GetComponent<Button>(); b.onClick.AddListener(() => OnBPlatformSelect(currentIndex)); Image img = t.GetComponent<Image>(); //Set color of the image, based on if owned or not img.color = SaveManager.Instance.IsPlatformsOwned(i) ? platformColor[currentIndex] : Color.Lerp(platformColor[currentIndex], new Color(0, 0, 0, 1), 0.25f); i++; } //Reset Index; i = 0; // Platform Panal foreach (Transform t in platModelPanel) { int currentIndex = i; Button b = t.GetComponent<Button>(); b.onClick.AddListener(() => OnPlatModelSelect(currentIndex)); Image img = t.GetComponent<Image>(); //Set color of the image, based on if owned or not img.color = SaveManager.Instance.IsPlatModelOwned(i) ? Color.white : new Color(0.7f, 0.7f, 0.7f); i++; } } // // Shop Buttons // private void OnColorSelect(int currentIndex) { Debug.Log("Selecting color button : " + currentIndex); if (selectedColorIndex == currentIndex) // if the button clicked is already selected, exit return; // Make the icon slightly bigger colorPanel.GetChild(currentIndex).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; // Put the previous one on normal scale colorPanel.GetChild(selectedColorIndex).GetComponent<RectTransform>().localScale = Vector3.one; selectedColorIndex = currentIndex; // Set the selected Color if (SaveManager.Instance.IsColorOwned(currentIndex)) // Change the content of the buy/set button, depending on the state of the color { // Color is owned // Is it already our current color? if (activeColorIndex == currentIndex) { colorBuySetText.text = "Current"; } else { colorBuySetText.text = "Select"; } } else { // Color isn't owned colorBuySetText.text = "Buy: " + colorCost[currentIndex].ToString(); } } private void OnBModelSelect(int currentIndex) { Debug.Log("Selecting BModel button : " + currentIndex); if (selectedBallsIndex == currentIndex) // if the button clicked is already selected, exit return; // Make the icon slightly bigger bModelPanel.GetChild(currentIndex).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; // Put the previous one on normal scale bModelPanel.GetChild(selectedBallsIndex).GetComponent<RectTransform>().localScale = Vector3.one; selectedBallsIndex = currentIndex; // Set the selected Color if (SaveManager.Instance.IsBallsOwned(currentIndex)) // Change the content of the buy/set button, depending on the state of the color { // Color is owned // Is it already our current color? if (activeBallsIndex == currentIndex) { bModelBuySetText.text = "Current"; } else { bModelBuySetText.text = "Select"; } } else { // Color isn't owned bModelBuySetText.text = "Buy: " + ballsCost[currentIndex].ToString(); } } private void OnBPlatformSelect(int currentIndex) { Debug.Log("Selecting PModel button : " + currentIndex); if (selectedPlatformsIndex == currentIndex) // if the button clicked is already selected, exit return; // Make the icon slightly bigger pModelPanel.GetChild(currentIndex).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; // Put the previous one on normal scale pModelPanel.GetChild(selectedPlatformsIndex).GetComponent<RectTransform>().localScale = Vector3.one; selectedPlatformsIndex = currentIndex; // Set the selected Color if (SaveManager.Instance.IsPlatformsOwned(currentIndex)) // Change the content of the buy/set button, depending on the state of the color { // Color is owned // Is it already our current color? if (activePlatformsIndex == currentIndex) { pModelBuySetText.text = "Current"; } else { pModelBuySetText.text = "Select"; } } else { // Color isn't owned pModelBuySetText.text = "Buy: " + platformsCost[currentIndex].ToString(); } } private void OnPlatModelSelect(int currentIndex) { Debug.Log("Selecting PModel button : " + currentIndex); if (selectedPlatModelIndex == currentIndex) // if the button clicked is already selected, exit return; // Make the icon slightly bigger platModelPanel.GetChild(currentIndex).GetComponent<RectTransform>().localScale = Vector3.one * 1.125f; // Put the previous one on normal scale platModelPanel.GetChild(selectedPlatModelIndex).GetComponent<RectTransform>().localScale = Vector3.one; selectedPlatModelIndex = currentIndex; // Set the selected Color if (SaveManager.Instance.IsPlatModelOwned(currentIndex)) // Change the content of the buy/set button, depending on the state of the color { // Color is owned // Is it already our current color? if (activePlatModelIndex == currentIndex) { platModelBuySetText.text = "Current"; } else { platModelBuySetText.text = "Select"; } } else { // Color isn't owned platModelBuySetText.text = "Buy: " + platModelCost[currentIndex].ToString(); } } public void OnColorBuySet() { Debug.Log("Buy/Set color"); if (SaveManager.Instance.IsColorOwned(selectedColorIndex)) // Is the selected color owned { SetColor(selectedColorIndex); // Set the color! } else { if (SaveManager.Instance.BuyColor(selectedColorIndex, colorCost[selectedColorIndex])) // Attempt to Buy the Colo { // Success! SetColor(selectedColorIndex); // Change the color of the button colorPanel.GetChild(selectedColorIndex).GetComponent<Image>().color = ballColor[selectedColorIndex]; // Update diamond Text // UpdateDiamondText(); } else { // DO not have enough Diamanten // Play sound feedback, wenn nicht genug Diamonds verfügbar Debug.Log("Not enough Diamonds"); } } } public void OnModelBuySet() { Debug.Log("Buy/Set BModel"); if (SaveManager.Instance.IsBallsOwned(selectedBallsIndex)) // Is the selected color owned { SetBalls(selectedBallsIndex); // Set the color! } else { if (SaveManager.Instance.BuyBModel(selectedBallsIndex, ballsCost[selectedBallsIndex])) // Attempt to Buy the Colo { // Success! SetBalls(selectedBallsIndex); // Change the color of the button //bModelPanel.GetChild(selectedBallsIndex).GetComponent<Image>().color = ballColor[selectedBallsIndex]; // Update diamond Text // UpdateDiamondText(); } else { // DO not have enough Diamanten // Play sound feedback, wenn nicht genug Diamonds verfügbar Debug.Log("Not enough Diamonds"); } } } public void OnPlatformBuySet() { Debug.Log("Buy/Set PlatforModel"); if (SaveManager.Instance.IsPlatformsOwned(selectedPlatformsIndex)) // Is the selected color owned { SetPlatforms(selectedPlatformsIndex); // Set the color! } else { if (SaveManager.Instance.BuyPModel(selectedPlatformsIndex, platformsCost[selectedPlatformsIndex])) // Attempt to Buy the Colo { // Success! SetPlatforms(selectedBallsIndex); // Change the color of the button pModelPanel.GetChild(selectedPlatformsIndex).GetComponent<Image>().color = platformColor[selectedPlatformsIndex]; // Update diamond Text // UpdateDiamondText(); } else { // DO not have enough Diamanten // Play sound feedback, wenn nicht genug Diamonds verfügbar Debug.Log("Not enough Diamonds"); } } } public void OnPlatModelBuySet() { Debug.Log("Buy/Set PlatModel"); if (SaveManager.Instance.IsPlatModelOwned(selectedPlatModelIndex)) // Is the selected color owned { SetPlatModel (selectedPlatModelIndex); // Set the color! } else { if (SaveManager.Instance.BuyPModel(selectedPlatformsIndex, platModelCost[selectedPlatModelIndex])) // Attempt to Buy the Colo { // Success! SetPlatModel(selectedPlatModelIndex); // Change the color of the button //platModelPanel.GetChild(selectedPlatModelIndex).GetComponent<Image>().color = platModelColor[selectedPlatModelIndex]; // Update diamond Text // UpdateDiamondText(); } else { // DO not have enough Diamanten // Play sound feedback, wenn nicht genug Diamonds verfügbar Debug.Log("Not enough Diamonds"); } } } //void OnGUI() //{ // //Switch this toggle to activate and deactivate the parent GameObject // m_ActivateParent = GUI.Toggle(new Rect(10, 10, 100, 30), m_ActivateParent, "Activate Parent GameObject"); // //Switch this toggle to activate and deactivate the child GameObject // m_ActivateChild = GUI.Toggle(new Rect(10, 40, 100, 30), m_ActivateChild, "Activate Child GameObject"); // //If a change is detected with the toggle, the console outputs updates // if (GUI.changed) // { // m_SelfOutput = false; // m_HierarchyOutput = false; // } //} //private void UpdateDiamondText() // Falls später der Diamantenstand in den Shop angezeigt werden soll || Diamantenstand sieht man auch durch den Shop //{ // DiamondsCounter.text = SaveManager.Instance.state.diamonds.ToString(); //} } Ich bin dankbar über jede Hilfe und Tipp, den ich bekommen kann. Viele Grüße Ashrag
×
×
  • Neu erstellen...