forked from adenlb/Vivid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request adenlb#2 from adenlb/jackbranch
Jackbranch
- Loading branch information
Showing
12 changed files
with
1,104 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.