from github

This commit is contained in:
jonas
2024-10-29 17:16:17 +01:00
commit 537f1d77fb
1074 changed files with 303521 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
//this script stors the selected color to the playerprefs
public class ColorButton : MonoBehaviour
{
[SerializeField] Color buttonColor;
[SerializeField] GameObject nameInput;
private void Start()
{
GetComponent<Image>().color = buttonColor;
GetComponent<Button>().onClick.AddListener(() =>
{
PlayerPrefs.SetFloat("playerColorR", buttonColor.r);
PlayerPrefs.SetFloat("playerColorG", buttonColor.g);
PlayerPrefs.SetFloat("playerColorB", buttonColor.b);
PlayerPrefs.Save();
transform.parent.parent.gameObject.SetActive(false);
changeScene();
});
}
public void changeScene()
{
//if the name has already been set, change the scene
if (nameInput.activeInHierarchy == false)
{
SceneManager.LoadScene("RoomCreation");
}
}
}