Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Assets/Bounce.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using UnityEngine;
using System.Collections;

public class Bounce : MonoBehaviour {

public GameObject button;

public bool pressed = false;
public bool collide = false;
int count = 0;


void Start()
{


}
void Update()
{
if (collide)
{
if (count == 0)
{
pressed = true;
Debug.Log("ON");
count++;
}

}
}

void OnTriggerEnter2D(Collider2D col)
{

Debug.Log("Enter");

collide = true;
Debug.Log(collide);


}
void OnTriggerExit2D(Collider2D col)
{
collide = false;
pressed = false;
Debug.Log("Exit");
count = 0;
}
}
12 changes: 12 additions & 0 deletions Assets/Bounce.cs.meta

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

60 changes: 30 additions & 30 deletions Assets/BowlsButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,46 @@

public class BowlsButton : MonoBehaviour {

public GameObject button;
public GameObject button;

public bool pressed = false;
public bool collide = false;
int count = 0;
//GameObject pressureplate1 = GameObject.FindGameObjectWithTag("pressureplate1");
void Start()
{
public bool pressed = false;
public bool collide = false;
int count = 0;
//GameObject pressureplate1 = GameObject.FindGameObjectWithTag("pressureplate1");
void Start()
{


}
void Update()
{
if (collide)
}
void Update()
{
if (count == 0)
if (collide)
{
pressed = true;
Debug.Log("ON");
count++;
}
if (count == 0)
{
pressed = true;
Debug.Log("ON");
count++;
}

}
}
}

void OnTriggerEnter2D(Collider2D col)
{
void OnTriggerEnter2D(Collider2D col)
{

Debug.Log("Enter");
Debug.Log("Enter");

collide = true;
Debug.Log(collide);
collide = true;
Debug.Log(collide);


}
void OnTriggerExit2D(Collider2D col)
{
collide = false;
pressed = false;
Debug.Log("Exit");
count = 0;
}
}
void OnTriggerExit2D(Collider2D col)
{
collide = false;
pressed = false;
Debug.Log("Exit");
count = 0;
}
}
Binary file added Assets/Moving Note.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Moving Note.unity.meta

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

123 changes: 123 additions & 0 deletions Assets/MovingNote.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;

public class MovingNote : MonoBehaviour {

SpriteRenderer sr, ss;
public GameObject SimonSaysSwitch;
public GameObject sb1, sb2, sb3, sb4, sb5;
List<int> sequence = new List<int>();
List<int> bpressed = new List<int>();
public GameObject door;
bool b1 = false, b2 = false, b3 = false, b4 = false, b5 = false;

int state = 0;
int rnd = 0;


void Start()
{
// Get a reference to the SpriteRenderer so that we can change the button's color.
gameObject.SetActive(true);
sequence.Add(4);
sequence.Add(3);
sequence.Add(2);
sequence.Add(1);
sequence.Add(0);

}

// Update is called once per frame
void Update()
{
if (SimonSaysSwitch.GetComponent<NoteSwitch>().pressed == true)
{
bpressed.Clear();
//sequence.Clear();
SimonSaysSwitch.GetComponent<NoteSwitch>().pressed = false;

}

if (sb1.GetComponent<NotesButton>().pressed == true && sb2.GetComponent<NotesButton>().pressed == false &&
sb3.GetComponent<NotesButton>().pressed == false && sb4.GetComponent<NotesButton>().pressed == false &&
sb5.GetComponent<NotesButton>().pressed == false)
{
Debug.Log("ORANGE");
sb1.GetComponent<NotesButton>().pressed = false;
bpressed.Add(4);
}

if (sb1.GetComponent<NotesButton>().pressed == false && sb2.GetComponent<NotesButton>().pressed == true &&
sb3.GetComponent<NotesButton>().pressed == false && sb4.GetComponent<NotesButton>().pressed == false &&
sb5.GetComponent<NotesButton>().pressed == false)
{
Debug.Log("PINK");
bpressed.Add(3);
sb2.GetComponent<NotesButton>().pressed = false;
}

if (sb1.GetComponent<NotesButton>().pressed == false && sb2.GetComponent<NotesButton>().pressed == false &&
sb3.GetComponent<NotesButton>().pressed == true && sb4.GetComponent<NotesButton>().pressed == false &&
sb5.GetComponent<NotesButton>().pressed == false)
{
Debug.Log("YELLOW");
bpressed.Add(2);
sb3.GetComponent<NotesButton>().pressed = false;
}

if (sb1.GetComponent<NotesButton>().pressed == false && sb2.GetComponent<NotesButton>().pressed == false &&
sb3.GetComponent<NotesButton>().pressed == false && sb4.GetComponent<NotesButton>().pressed == true &&
sb5.GetComponent<NotesButton>().pressed == false)
{
Debug.Log("GREEN");
bpressed.Add(1);
sb4.GetComponent<NotesButton>().pressed = false;
}

if (sb1.GetComponent<NotesButton>().pressed == false && sb2.GetComponent<NotesButton>().pressed == false &&
sb3.GetComponent<NotesButton>().pressed == false && sb4.GetComponent<NotesButton>().pressed == false &&
sb5.GetComponent<NotesButton>().pressed == true)
{
Debug.Log("BLUE");
bpressed.Add(0);
sb5.GetComponent<NotesButton>().pressed = false;
}


if (bpressed.Count > 4)
{
if (sequence[0] == bpressed[0])
{
Debug.Log("b1 = true");
b1 = true;
}
if (sequence[1] == bpressed[1])
{
Debug.Log("b2 = true");
b2 = true;
}
if (sequence[2] == bpressed[2])
{
Debug.Log("b3 = true");
b3 = true;
}
if (sequence[3] == bpressed[3])
{
Debug.Log("b4 = true");
b4 = true;
}
if (sequence[4] == bpressed[4])
{
Debug.Log("b5 = true");
b5 = true;
}
if (b1 == true && b2 == true && b3 == true && b4 == true && b5 == true)
{
GameObject.Destroy(door);
}
}
// Debug.Log(bpressed[0] + bpressed[1] + bpressed[2] + bpressed[3]);
}
}
12 changes: 12 additions & 0 deletions Assets/MovingNote.cs.meta

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

43 changes: 43 additions & 0 deletions Assets/MovingStringNotes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;

public class MovingStringNotes : MonoBehaviour
{

public Transform point1;
Vector3 start;
Vector3 end;
public float speed = .05f;
bool x = true;
int counter = 0;


void Update()
{

if (counter == 0)
{
start = new Vector3(point1.position.x, point1.position.y - 6.5f, point1.position.z);
end = new Vector3(point1.position.x, point1.position.y + 6.5f, point1.position.z);
}

if (point1.position == end)
{
x = false;
}
else if (point1.position == start)
{
x = true;
}
if (point1.position == end || x == false)
{
transform.position = Vector3.MoveTowards(point1.position, start, speed);
counter += 1;
}
else if (point1.position != end)
{
transform.position = Vector3.MoveTowards(point1.position, end, speed);
counter += 1;
}
}
}
12 changes: 12 additions & 0 deletions Assets/MovingStringNotes.cs.meta

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

43 changes: 43 additions & 0 deletions Assets/NoteSwitch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;

public class NoteSwitch : MonoBehaviour {

public bool stepped;
int state = 0;
public bool pressed;

void Start()
{

stepped = false;
pressed = false;

}

void Update()
{
// If the player is colliding with the button and E is pressed, advance the state.
// This check should be placed in Update() instead of one of the below functions
// since Update() executes more frequently and is less likely to cause missed checks.
if (stepped && Input.GetKeyDown(KeyCode.E))
{
Debug.Log("ON");
pressed = true;
}
}

// NOTE: Set the Player object's RigidBody2D -> Sleeping Mode to Never Sleep, otherwise
// the collision check will eventually stop due to the player object going to sleep.
void OnTriggerStay2D(Collider2D other)
{
if (other.gameObject.tag == "Player")
stepped = true;
}

void OnTriggerExit2D(Collider2D other)
{
if (other.gameObject.tag == "Player")
stepped = false;
}
}
12 changes: 12 additions & 0 deletions Assets/NoteSwitch.cs.meta

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

Loading