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
Binary file added Assets/Chandelure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions Assets/Chandelure.png.meta

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

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

public class GlowScript : MonoBehaviour {

Behaviour halo; //Access the halo effect, AKA Glowing effect
bool stepped = false; //A boolean to know if we are in contact with the object

// Use this for initialization
void Start () {
halo = (Behaviour)GetComponent("Halo");
halo.enabled = true;
}

// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.E) && stepped) //If the player steps on the object and presses E, the glow will stop
{
halo.enabled = false;
}
}

void OnTriggerEnter2D() { //When we collide with the object, stepped is true, if not false
stepped = true;
}
}
12 changes: 12 additions & 0 deletions Assets/GlowScript.cs.meta

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

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

public class NewBehaviourScript : MonoBehaviour {

// Use this for initialization
void Start () {

}

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

}
}
12 changes: 12 additions & 0 deletions Assets/NewBehaviourScript.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/PlatformRotation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;

public class PlatformRotation : MonoBehaviour {

public float rotationDelay = 2f;
public float speed = 1;
public GameObject platform;
private Rigidbody2D rb2d;
private HingeJoint2D hinge;

// Use this for initialization
void Start() {

}

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

}

void Awake() {
rb2d = GetComponent<Rigidbody2D>();
rb2d.isKinematic = true;
hinge = GetComponent<HingeJoint2D>();
JointAngleLimits2D limits = hinge.limits;
limits.min = -90;
limits.max = 90;
hinge.limits = limits;
hinge.useLimits = true;
}

void OnCollisionEnter2D(Collision2D other) {
if (other.gameObject.CompareTag("Player")) {
Invoke("Rotate", rotationDelay);
}
}

void Rotate() {
rb2d.isKinematic = false;
}
}

12 changes: 12 additions & 0 deletions Assets/PlatformRotation.cs.meta

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

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

public class PlatformSpawner : MonoBehaviour {

public int maxNumberPlatforms = 4;
public GameObject platform; //A platform prefab
public GameObject platformSwitch = GameObject.Find("platformSwitch"); //A platform swtich prefab


public GameObject[] platformArray; //Stores each platform so we can keep track of them
public GameObject[] platformSwitchArray; //Stores each switch

public float horizontalMin = 1f;
public float horizontalMax = -1f;
public float verticalMin = 1f;
public float verticalMax = 2f;

private Vector2 originPosition;

// Use this for initialization
void Start () {
platformArray = new GameObject[maxNumberPlatforms + 1];
platformSwitchArray = new GameObject[maxNumberPlatforms + 1];

//platform = GameObject.Find("platform");
//platformSwitch = GameObject.Find("platformSwitch");
PlatformSwitchDetection detect = platformSwitch.GetComponent<PlatformSwitchDetection>();


for (int i = 0; i < maxNumberPlatforms + 1; i++) {
platformArray[i] = platform;
platformSwitchArray[i] = platformSwitch;
}

originPosition = transform.position;
Instantiate(platformArray[0], originPosition, Quaternion.identity);
Vector2 switchPosition = new Vector2(originPosition.x, originPosition.y - 1);
Instantiate(platformSwitch, switchPosition, Quaternion.identity);
Spawn();
}

// Update is called once per frame
void Update () {
int count = 0;
for (int i = 0; i < maxNumberPlatforms + 1; i++)
{
PlatformSwitchDetection detect = platformSwitchArray[i].GetComponent<PlatformSwitchDetection>();
if (detect) {
count++;
}
}
if (count == 5) {
Instantiate(platform, new Vector2(0, 0), Quaternion.identity);
}
}

void Spawn() {
for (int i = 1; i < maxNumberPlatforms + 1; i++) {
//Creates a new position based on the origin position using the ranges defined
Vector2 randomPosition = originPosition + new Vector2(Random.Range(horizontalMin, horizontalMax), Random.Range(verticalMin, verticalMax));
Instantiate(platformArray[i], randomPosition, Quaternion.identity); //Spawns the platform at the randomPosition
Vector2 switchPosition = new Vector2(randomPosition.x, randomPosition.y - 1);
Instantiate(platformSwitch, switchPosition, Quaternion.identity);
originPosition = randomPosition; //Sets the originPosition to the randomPosition as reference for the next platform to spawn
}
}
}
12 changes: 12 additions & 0 deletions Assets/PlatformSpawner.cs.meta

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

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

public class PlatformSwitchDetection : MonoBehaviour {

public bool switchActive = false;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
if (switchActive) {
Debug.Log("WAHOOOOOOOOOOOOO");
}
}

void OnCollisionEnter2D(Collision2D other) {
if (other.gameObject.CompareTag("platform")) {
Activate();
}
}

void Activate() {
switchActive = true;
}
}
12 changes: 12 additions & 0 deletions Assets/PlatformSwitchDetection.cs.meta

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

Binary file added Assets/Prefabs/Chandelure.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Prefabs/Chandelure.prefab.meta

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

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

Binary file added Assets/Prefabs/PlaceholderObj/platform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions Assets/Prefabs/PlaceholderObj/platform.png.meta

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

Binary file added Assets/Prefabs/Wobbuffet.prefab
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Prefabs/Wobbuffet.prefab.meta

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

Binary file added Assets/Prefabs/platform.prefab
Binary file not shown.
Loading