Skip to content

Commit

Permalink
added emission
Browse files Browse the repository at this point in the history
objects now emit their color
  • Loading branch information
adenlb committed Nov 14, 2016
1 parent db79796 commit 046cd97
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 32 deletions.
124 changes: 92 additions & 32 deletions colour_change.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class colour_change : MonoBehaviour {
// Use this for initialization
void Start () {
lite.color = Color.white;
update_objects();
// col_text.text = "Current Lens: White";
}

Expand All @@ -37,8 +38,10 @@ void update_objects()
{
foreach (Transform rend in Platforms) {
string cooler = rend.tag;
if (cooler == "white")
rend.GetComponent<Renderer>().material.color = lite.color;
if (cooler == "white") {
rend.GetComponent<Renderer> ().material.color = lite.color;
rend.GetComponent<Renderer> ().material.SetColor("_EmissionColor", lite.color);
}
if (cooler == "red")
update_r (rend);
if (cooler == "blue")
Expand Down Expand Up @@ -79,106 +82,163 @@ void update_objects()

void restore_color(Transform rend)
{
if (rend.tag == "white")
if (rend.tag == "white") {
rend.GetComponent<Renderer> ().material.color = Color.white;
if (rend.tag == "red")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}
if (rend.tag == "red") {
rend.GetComponent<Renderer> ().material.color = Color.red;
if (rend.tag == "green")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.red);
}
if (rend.tag == "green") {
rend.GetComponent<Renderer> ().material.color = Color.green;
if (rend.tag == "blue")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
if (rend.tag == "blue"){
rend.GetComponent<Renderer> ().material.color = Color.blue;
if (rend.tag == "yellow")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.blue);
}
if (rend.tag == "yellow") {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
if (rend.tag == "magenta")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
if (rend.tag == "magenta"){
rend.GetComponent<Renderer> ().material.color = Color.magenta;
if (rend.tag == "cyan")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
if (rend.tag == "cyan"){
rend.GetComponent<Renderer> ().material.color = Color.cyan;
if (rend.tag == "black")
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.cyan);
}
if (rend.tag == "black") {
rend.GetComponent<Renderer> ().material.color = Color.black;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.black);
}
}
void update_r(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.white;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.magenta;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
}

void update_b(Transform rend)
{
if (lite.color == Color.white){
restore_color (rend);
}
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.magenta;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.cyan;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.white;

rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}

}

void update_g(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.white;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.cyan;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.cyan);
}
}

void update_y(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.green;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.red;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.red);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.black;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.black);
}
}
void update_c(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.black;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.black);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.blue;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.blue);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.green;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
}
//magenta
void update_m(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.blue;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.blue);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.black;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.black);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.red;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.red);
}
}
void update_black(Transform rend)
{
if (lite.color == Color.white)
restore_color (rend);
if (lite.color == Color.red)
if (lite.color == Color.red) {
rend.GetComponent<Renderer> ().material.color = Color.cyan;
if (lite.color == Color.green)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.cyan);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.magenta;
if (lite.color == Color.blue)
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
if (lite.color == Color.blue) {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
}

// Update is called once per frame
Expand Down
18 changes: 18 additions & 0 deletions game_manager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using UnityEngine;
using System.Collections;

public class game_manager : MonoBehaviour {
//initializes game, sets up level, transitions between levels
//handles restarts, UI, player Death, saving, loading

//Level == scene, puzzle == most recent point in scene reached
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
}
12 changes: 12 additions & 0 deletions game_manager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 046cd97

Please sign in to comment.