prototype v0.01

This commit is contained in:
2022-07-13 20:33:37 +02:00
parent 5e40207b1c
commit df98698621
55 changed files with 5767 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
public enum Colors {
None = -1,
Grey,
Red,
Blue,
Green,
Yellow,
Rainbow
};
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);
}
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;
}
} else {
toPaint.GetComponent<Renderer>().material.color = colorMaterials[(int)color].color;
}
}
public void CheckGroundColor(GameObject collided) {
if (transform.GetComponent<Renderer>().material.color != collided.transform.GetComponent<Renderer>().material.color) {
Debug.Log("The colors are not the same! GroundColor: " + collided.transform.GetComponent<Renderer>().material.color + " PlayerColor: "
+ transform.GetComponent<Renderer>().material.color);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab4fe611c9713254e9fcc6e0de77f87f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float moveSpeed = 5f;
private Vector3 direction;
public Rigidbody rb;
private float horizontal, vertical;
private void Awake() {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
horizontal = Input.GetAxis("Horizontal");
vertical = Input.GetAxis("Vertical");
direction = new Vector3(horizontal, 0,vertical);
rb.AddForce(direction * moveSpeed);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cb738793c052dd54597cff2d5ea33de3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: