Skip to content

Commit

Permalink
Merge pull request adenlb#2 from adenlb/jackbranch
Browse files Browse the repository at this point in the history
Jackbranch
  • Loading branch information
adenlb authored Nov 18, 2016
2 parents 6e70972 + b17a6e4 commit d9d63ce
Show file tree
Hide file tree
Showing 12 changed files with 1,104 additions and 275 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
11/18/16 jack update:
scripts and an explanation can be found in my update. i implemented the
game manager, fixed some physics bugs, cleaned up lens enabling, updated
ui transitions, and created tutorials (exported as an asset package, can be
found on dropbox).

Vivid
11/14/2016
Aden, Charles, Jack, Chris, Xu, Mike
Expand Down
35 changes: 35 additions & 0 deletions README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Vivid
11/14/2016
Aden, Charles, Jack, Chris, Xu, Mike

This repository holds the scripts used in our video game, VIVID.

As of 11/14/16, the three scripts most important to keep track of are:

color_change:
applied to the character controller, changes the color of light and objects
and calls on_update
Update_plats:
also applied to the character controller, changes the physics of
platform type objects based on their color.
NOTE: plats must be cubes with rigidbodies
Update_intrs:
also applied to the character controller, changes the physics of
'interactable' type objects based on their color.
NOTE: intrs must be cylinders or capsules with rigidbodies

Upcoming changes:

Implement a gamemangager to set up levels and transition between scenes

Implement the UI

Implement deaths and level transitions

To Consider:

Expand this repository to include prefabs, materials, and art/textures

New Object Type with simple AI behavior?

Ability to pick up and put down certain objects?
276 changes: 1 addition & 275 deletions colour_change.cs
Original file line number Diff line number Diff line change
@@ -1,275 +1 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class colour_change : MonoBehaviour {
public Update_plats Update_plats;
public Update_intrs Update_intrs;
public Light lite;
public Transform Platforms;
public Transform Interacts;

public bool enabled;
public bool r_enabled;
public bool b_enabled;
public bool g_enabled;
public bool rclick_enabled;

// public Text col_text;
// Use this for initialization
void Start () {
lite.color = Color.white;
update_objects();
// col_text.text = "Current Lens: White";
}

void change()
{

if (lite.color == Color.white) {
lite.color = Color.red;
// col_text.text = "Current Lens: Red";
} else if (lite.color == Color.red) {
lite.color = Color.green;
// col_text.text = "Current Lens: Green";
} else if (lite.color == Color.green) {
lite.color = Color.blue;
// col_text.text = "Current Lens: Blue";
} else if (lite.color == Color.blue) {
lite.color = Color.white;
// col_text.text = "Current Lens: White";
}
}

void update_objects()
{
foreach (Transform rend in Platforms) {
string cooler = rend.tag;
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")
update_b (rend);
if (cooler == "green")
update_g (rend);
if (cooler == "yellow")
update_y (rend);
if (cooler == "magenta")
update_m (rend);
if (cooler == "cyan")
update_c (rend);
if (cooler == "black")
update_black (rend);
Update_plats.on_change (rend);
}
foreach (Transform rend in Interacts) {
string cooler = rend.tag;
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")
update_b (rend);
if (cooler == "green")
update_g (rend);
if (cooler == "yellow")
update_y (rend);
if (cooler == "magenta")
update_m (rend);
if (cooler == "cyan")
update_c (rend);
if (cooler == "black")
update_black (rend);
Update_intrs.on_change (rend);
}
}

void restore_color(Transform rend)
{
if (rend.tag == "white") {
rend.GetComponent<Renderer> ().material.color = Color.white;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}
if (rend.tag == "red") {
rend.GetComponent<Renderer> ().material.color = Color.red;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.red);
}
if (rend.tag == "green") {
rend.GetComponent<Renderer> ().material.color = Color.green;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
if (rend.tag == "blue"){
rend.GetComponent<Renderer> ().material.color = Color.blue;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.blue);
}
if (rend.tag == "yellow") {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
if (rend.tag == "magenta"){
rend.GetComponent<Renderer> ().material.color = Color.magenta;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
if (rend.tag == "cyan"){
rend.GetComponent<Renderer> ().material.color = Color.cyan;
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) {
rend.GetComponent<Renderer> ().material.color = Color.white;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.white);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
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) {
rend.GetComponent<Renderer> ().material.color = Color.magenta;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.magenta);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.cyan;
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) {
rend.GetComponent<Renderer> ().material.color = Color.yellow;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.yellow);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.white;
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) {
rend.GetComponent<Renderer> ().material.color = Color.green;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.green);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.red;
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) {
rend.GetComponent<Renderer> ().material.color = Color.black;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.black);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.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) {
rend.GetComponent<Renderer> ().material.color = Color.blue;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.blue);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.black;
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) {
rend.GetComponent<Renderer> ().material.color = Color.cyan;
rend.GetComponent<Renderer> ().material.SetColor ("_EmissionColor", Color.cyan);
}
if (lite.color == Color.green) {
rend.GetComponent<Renderer> ().material.color = Color.magenta;
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
void Update () {
if (enabled) {
if (Input.GetKeyDown (KeyCode.Mouse1) && rclick_enabled) {
change ();
update_objects ();
} else if (Input.GetKeyDown (KeyCode.C) && r_enabled) {
lite.color = Color.red;
update_objects ();
} else if (Input.GetKeyDown (KeyCode.V) && b_enabled) {
lite.color = Color.blue;
update_objects ();
} else if (Input.GetKeyDown (KeyCode.B) && g_enabled) {
lite.color = Color.green;
update_objects ();
} else if (Input.GetKeyDown (KeyCode.N)) {
lite.color = Color.white;
update_objects ();
}
}
}

}
hwirugh
Loading

0 comments on commit d9d63ce

Please sign in to comment.