Built out a simple level with some puzzles

This commit is contained in:
2018-04-21 21:46:34 +10:00
parent a8741ccc26
commit 011a1ce0c3
37 changed files with 12006 additions and 93 deletions
+2
View File
@@ -11,6 +11,8 @@ public class BlockIce : MonoBehaviour {
void Awake() {
rigidBody = GetComponent<Rigidbody2D> ();
rigidBody.Sleep ();
}
void OnTriggerEnter2D(Collider2D collider) {
+22
View File
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset;
// Use this for initialization
void Awake () {
if (player != null) {
offset = transform.position - player.transform.position;
}
}
// Update is called once per frame
void Update () {
if (player != null) {
transform.position = player.transform.position + offset;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 060d9dea8b9cab04d91d3c3e34c81e0a
timeCreated: 1524303031
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -5,7 +5,7 @@ using UnityEngine;
//shootable
public class FireDamager : DamagerBase {
void OnTriggerEnter2D(Collider2D collider) {
if (collider.gameObject.GetComponent<FireDamager> () == null) { //pass through other instances of self
if (collider.gameObject.GetComponent<FireDamager> () == null && collider.gameObject.GetComponent<BlockGap> () == null) { //pass through other instances of self
Destroy (gameObject);
}
}
+12
View File
@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//shootable
public class IceDamager : DamagerBase {
void OnTriggerEnter2D(Collider2D collider) {
if (collider.gameObject.GetComponent<IceDamager> () == null && collider.gameObject.GetComponent<BlockGap> () == null) { //pass through other instances of self
Destroy (gameObject);
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 4b0265e5d9f1a804aaa77a77754f51e0
timeCreated: 1524281573
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+4 -1
View File
@@ -29,11 +29,14 @@ public class Player : MonoBehaviour {
animator = GetComponent<Animator> ();
rigidBody = GetComponent<Rigidbody2D> ();
speed = 1f;
speed = 0.79f;
}
void Update() {
HandleInput ();
}
void FixedUpdate() {
Move ();
Attack ();
SendAnimationInfo ();
+34
View File
@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Respawner : MonoBehaviour {
public GameObject instance;
GameObject saved;
Vector3 startPos;
float timer = float.NegativeInfinity;
public float delay = 3f;
void Awake() {
//make a backup copy
saved = Instantiate (instance);
saved.SetActive (false);
startPos = instance.transform.position;
}
void FixedUpdate() {
//start the countdown
if (timer == float.NegativeInfinity && instance == null) {
timer = Time.time;
}
//stop the countdown
if (timer != float.NegativeInfinity && Time.time - timer >= delay) {
instance = Instantiate (saved);
instance.SetActive (true);
instance.transform.position = startPos;
timer = float.NegativeInfinity;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: fc5e919ff297917418f0fd7fea3ec391
timeCreated: 1524307401
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: