Commit 062ea0b1 authored by Danny Huang's avatar Danny Huang
Browse files

hero can be transferred between scenes

parent b3f7268a
using UnityEngine;
using System.Collections;
public class HeroSpawnPoint : MonoBehaviour
{
protected GameObject hero;
void Start ()
{
this.hero = GameObject.FindGameObjectWithTag ("Player");
/* Teleport Hero to spawn point */
hero.transform.position = this.transform.position;
}
void Update ()
{
}
}
fileFormatVersion: 2
guid: a0a1a98abe88db349b13ec01fa4d1f2b
timeCreated: 1480210392
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f74747c5c0fc3ff429984074c83570a5
timeCreated: 1480210380
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class HeroGeneral : MonoBehaviour
{
void Awake ()
{
/* Allow this gameobject to persist between scenes */
DontDestroyOnLoad (this.gameObject);
}
void Start()
{
}
void Update ()
{
}
}
fileFormatVersion: 2
guid: 17bf23b631603024baf2fde46a2f2e61
timeCreated: 1480209011
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -17,8 +17,6 @@ public class ProjectileController : MonoBehaviour {
void OnCollisionEnter2D(Collision2D other)
{
Debug.Log (other.transform.tag);
if (this.gunCtrl != null &&
!other.transform.CompareTag ("Item"))
{
......
fileFormatVersion: 2
guid: 426a34defb6103942a64f7f4f421d50c
folderAsset: yes
timeCreated: 1480211051
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -2,11 +2,16 @@
using UnityEngine.SceneManagement;
using System.Collections;
public class levelTwoScript : MonoBehaviour {
public class FinishFlag : MonoBehaviour
{
public string nextSceneName;
void OnCollisionEnter2D(Collision2D cal){
if(cal.gameObject.CompareTag("Player")){
SceneManager.LoadScene ("level2");
void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene (nextSceneName);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e4ac1c0967376614d9ba9054a43c0289
timeCreated: 1480211076
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
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