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

added ending

parent f5f30f1d
fileFormatVersion: 2
guid: 97557fb901560d849a5a5695c9c2754d
timeCreated: 1479949270
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0544218e97eb70b4f9efb872b31da98a
folderAsset: yes
timeCreated: 1480223280
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class EndingManager : MonoBehaviour {
void Start ()
{
/* Remove Hero from Ending Scene */
GameObject hero = GameObject.FindGameObjectWithTag ("Hero");
if (hero != null)
Destroy (hero);
}
void Update ()
{
}
}
fileFormatVersion: 2
guid: d97f5f3c657d5fe409572bf5082dfa09
timeCreated: 1480209111
guid: a12b6e320a079de4ca8a8c2055b75fc7
timeCreated: 1480225559
licenseType: Free
MonoImporter:
serializedVersion: 2
......
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TypewriterEffect : MonoBehaviour {
[TextArea]
public string message;
public float charPerSec;
protected float nextCharRevealTime;
protected int nextCharIdx;
protected Text textComp;
void Start ()
{
this.textComp = GetComponent<Text> ();
this.nextCharIdx = 0;
this.nextCharRevealTime = Time.time + charPerSec;
}
void Update ()
{
if (textComp.text != this.message) {
if (Time.time > this.nextCharRevealTime || char.IsWhiteSpace(this.message[nextCharIdx])) {
this.textComp.text += message[nextCharIdx];
this.nextCharIdx++;
this.nextCharRevealTime = Time.time + charPerSec;
}
}
}
}
fileFormatVersion: 2
guid: 54aa85b4a416435438778955f5945149
timeCreated: 1476394005
guid: 09aaf1841b698864cb8d89dba5b77856
timeCreated: 1480223326
licenseType: Free
MonoImporter:
serializedVersion: 2
......
......@@ -4,6 +4,7 @@ using System.Collections;
public class ScrollingGroundCtrl : MonoBehaviour {
public float speed;
public bool isMovingRight;
public float resetPos_x;
protected Vector3 originalPos;
......@@ -20,8 +21,15 @@ public class ScrollingGroundCtrl : MonoBehaviour {
newPos.x -= this.speed;
this.transform.position = newPos;
if (this.transform.position.x < resetPos_x) {
this.transform.position = this.originalPos;
if (this.isMovingRight) {
if (this.transform.position.x < resetPos_x) {
this.transform.position = this.originalPos;
}
} else {
if (this.transform.position.x > resetPos_x) {
this.transform.position = this.originalPos;
}
}
}
}
using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;
public class levelThreeScript : MonoBehaviour {
void OnCollisionEnter2D(Collision2D cal){
if(cal.gameObject.CompareTag("Player")){
SceneManager.LoadScene ("level3");
}
}
}
using UnityEngine;
using System.Collections;
public class resetPlayer : MonoBehaviour {
public GameObject check;
void Start() {
}
void OnTriggerEnter2D(Collider2D other){
if(other.CompareTag("Player")){
other.gameObject.SendMessage("TakeEnvironmentDamage", -5);
other.gameObject.transform.position = ( new Vector3(check.transform.position.x, check.transform.position.y, check.transform.position.z));
}
}
}
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