SceneUIManager added
This commit is contained in:
@@ -17,16 +17,6 @@ public class ColorManager : MonoBehaviour
|
||||
{
|
||||
public Material[] colorMaterials = new Material[Enum.GetNames(typeof(Colors)).Length];
|
||||
|
||||
private void OnCollisionEnter(Collision collision) {
|
||||
if (collision.collider.CompareTag("Water")) {
|
||||
WashColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("Ground")){
|
||||
CheckGroundColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("ColorChanger")) {
|
||||
SetColor(Colors.None, transform.gameObject, collision);
|
||||
}
|
||||
}
|
||||
|
||||
public void WashColor(GameObject washed) {
|
||||
SetColor(Colors.Grey, washed);
|
||||
}
|
||||
@@ -34,7 +24,7 @@ public class ColorManager : MonoBehaviour
|
||||
public void SetColor(Colors color, GameObject toPaint, Collision collision = null) {
|
||||
if(color == Colors.None) {
|
||||
if (collision.transform.CompareTag("ColorChanger")) {
|
||||
transform.GetComponent<Renderer>().material.color = collision.transform.GetComponent<Renderer>().material.color;
|
||||
toPaint.GetComponent<Renderer>().material.color = collision.transform.GetComponent<Renderer>().material.color;
|
||||
}
|
||||
} else {
|
||||
toPaint.GetComponent<Renderer>().material.color = colorMaterials[(int)color].color;
|
||||
@@ -48,4 +38,14 @@ public class ColorManager : MonoBehaviour
|
||||
+ transform.GetComponent<Renderer>().material.color);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision) {
|
||||
if (collision.collider.CompareTag("Water")) {
|
||||
WashColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("Ground")) {
|
||||
CheckGroundColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("ColorChanger")) {
|
||||
SetColor(Colors.None, transform.gameObject, collision);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,17 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
public Rigidbody rb;
|
||||
public float moveSpeed = 5f;
|
||||
public float jumpforce = 5f;
|
||||
private Vector3 direction;
|
||||
public Rigidbody rb;
|
||||
private float horizontal, vertical;
|
||||
public float isJumping;
|
||||
private float horizontal, vertical, isJumping;
|
||||
private bool isOnGround;
|
||||
|
||||
|
||||
private void Awake() {
|
||||
rb = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
horizontal = Input.GetAxis("Horizontal");
|
||||
|
||||
33
Assets/Scripts/SceneUIManager.cs
Normal file
33
Assets/Scripts/SceneUIManager.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class SceneUIManager : MonoBehaviour
|
||||
{
|
||||
private int menuSceneIndex = 0, currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
|
||||
|
||||
public void LoadMenuScene() {
|
||||
SceneManager.LoadScene(menuSceneIndex);
|
||||
}
|
||||
|
||||
public void LoadPauseMenu() {
|
||||
//to be implemented when the ui is done
|
||||
}
|
||||
|
||||
public void LoadOptionsMenu() {
|
||||
//to be implemented when the ui is done
|
||||
}
|
||||
|
||||
public void LoadNextScene() {
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
|
||||
}
|
||||
|
||||
public void LoadScene(int sceneIndex) {
|
||||
SceneManager.LoadScene(sceneIndex);
|
||||
}
|
||||
|
||||
public void DisableUI(string UIName) {
|
||||
//to be implemented when some ui is done
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneUIManager.cs.meta
Normal file
11
Assets/Scripts/SceneUIManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e14c8833040013f4f9c1d59cd1d9dd8e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user