Commit bcde03ea authored by Danny Huang's avatar Danny Huang
Browse files

fixed door being locked forever if died in the underground section of level 1....

fixed door being locked forever if died in the underground section of level 1. Fixed bug where spikes would Destroy enemies and items on contact. Brighten the spiders to make them more visible from background. Press P to reset game
parent 6e5512ff
using UnityEngine;
using System.Collections;
public class HeroGeneral : MonoBehaviour
{
void Awake ()
......@@ -18,4 +19,5 @@ public class HeroGeneral : MonoBehaviour
{
}
}
......@@ -19,11 +19,15 @@ public class RandomItemCtrl : MonoBehaviour {
Item item = (Item)this.itemGenCtrl.GetRandomItem(this.type, this.subtype, this.rarity);
GameObject go = (GameObject)Instantiate(item.gameObject, this.transform.position, Quaternion.identity, null);
this.itemGenCtrl.RemoveCloneStrFromName(go);
this.itemGenCtrl.RemoveCloneStrFromName(go);
if (go.GetComponent<ItemCtrl> ().type == eItemType.COLLECTABLE)
go.GetComponent<Rigidbody2D> ().isKinematic = false;
/* Make spawned loot fly in the air as its dropped animation */
Vector2 spawnForce = new Vector2 (Random.Range(-50,50), Random.Range(100,200));
go.GetComponent<Rigidbody2D> ().AddForce (spawnForce);
Destroy(this.gameObject);
}
......
fileFormatVersion: 2
guid: af4ec3788c36956449373d9b101935d2
folderAsset: yes
timeCreated: 1481132541
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
void Awake()
{
}
void Start ()
{
}
void Update ()
{
if (Input.GetButtonDown ("ResetGame"))
ResetGame ();
}
public void ResetGame()
{
GameObject hero = GameObject.Find ("Hero");
Destroy (hero);
SceneManager.LoadScene ("title");
}
}
fileFormatVersion: 2
guid: fa229963a6a15ea429251eadb903d0c2
timeCreated: 1481132432
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f2c94700faede1343a97200912f0f6e7
timeCreated: 1481132584
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -15,7 +15,8 @@ public class Hazard : MonoBehaviour
else
other.gameObject.SendMessage ("TakeEnvironmentDamage", -5);
} else {
Destroy (other.gameObject);
if (this.isInstantDeathZone)
Destroy (other.gameObject);
}
}
......
......@@ -5,12 +5,21 @@ public class doorLock : MonoBehaviour {
public GameObject door1;
public GameObject door2;
void OnTriggerEnter2D(Collider2D other){
if(other.CompareTag("Player")){
door1.SetActive (true);
door2.SetActive (true);
gameObject.SetActive (false);
void OnTriggerEnter2D(Collider2D other)
{
if(other.CompareTag("Player"))
{
LockDoor (true);
}
}
public void LockDoor(bool isLock)
{
door1.GetComponent<BoxCollider2D>().enabled = isLock;
door1.GetComponent<SpriteRenderer> ().enabled = isLock;
door2.GetComponent<BoxCollider2D>().enabled = isLock;
door2.GetComponent<SpriteRenderer>().enabled = isLock;
}
}
......@@ -3,17 +3,20 @@ using System.Collections;
public class unlockYellow : MonoBehaviour {
public GameObject door1;
public GameObject door2;
public GameObject doorLock;
public bool isDestroySelfOnPickup;
void OnTriggerEnter2D(Collider2D other)
{
if(other.CompareTag("Player"))
{
if (doorLock != null)
doorLock.SendMessage ("LockDoor", false);
void OnTriggerEnter2D(Collider2D other){
if(other.CompareTag("Player")){
door1.SetActive (false);
door2.SetActive (false);
gameObject.SetActive (false);
if (isDestroySelfOnPickup) {
Destroy (doorLock);
gameObject.SetActive (false);
}
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment