Commit 1d223af3 authored by Ashley's avatar Ashley

birb can die, wintrigger calls gamemanager.win

parent ee05c260
fileFormatVersion: 2
guid: fd1726b5e39eb274788bf69228e2f40b
timeCreated: 1490315021
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fb8d612daf908b1488558da90e9ccb48
timeCreated: 1490315021
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: eeaeb0f182e77544ebce575a291491d8
timeCreated: 1490315020
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -10,9 +10,11 @@ public class GameManager : SingletonBehaviour<GameManager>
private bool _isPaused;
private float _levelTimer;
public Text timerText;
private GameObject birb;
void Awake()
{
birb = GameObject.Find("Player");
DontDestroyOnLoad(this);
//isPaused = true;
}
......@@ -46,11 +48,11 @@ public class GameManager : SingletonBehaviour<GameManager>
get; set;
}
public void Fail()
public static void Fail()
{
Debug.Log("You have died");
}
public void Win()
public static void Win()
{
Debug.Log("You won!");
}
......
fileFormatVersion: 2
guid: 7b7d3f3d2b4ff03489f18aebd64d9b5a
timeCreated: 1490315021
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2f36e02386af17344b5a6eb917a1da97
timeCreated: 1490315020
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -5,6 +5,8 @@ using UnityEngine.SceneManagement;
public class Birb : AbstractBehavior {
public bool isDead { get; private set; }
//Add the name of the animations to be played.
private string idleAnim = "";
private string walkAnim = "";
......@@ -40,8 +42,11 @@ public class Birb : AbstractBehavior {
public void Die()
{
animator.Play (hurtAnim);
GameManager.instance.Fail ();
isDead = true;
animator.SetBool("is dead", true);
body.isKinematic = true;
body.velocity = Vector2.zero;
GameManager.Fail ();
}
//Determines if the animation state must change.
......
......@@ -8,7 +8,7 @@ public class Hazard : MonoBehaviour {
{
if (other.CompareTag("Player"))
{
// other.GetComponent<Birb>().Die ();
other.gameObject.SendMessage("Die", SendMessageOptions.DontRequireReceiver);
}
}
}
......@@ -10,9 +10,8 @@ public class WinTrigger : MonoBehaviour {
if(other.gameObject.name == "Player") //ensuring it's the player
{
//tell manager it has won
//GameManager.instance.Win();
//GameEditor.Win()
//Debug.Log("Victory Achieved");
GameManager.Win();
//Debug.Log("Victory A;chieved");
}
}
}
Markdown is supported
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