Worked on re-implementing powerups through GUI

main
Ivy 4 years ago
parent 9da379ebc6
commit 061b635c27

@ -777,7 +777,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 526643977}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1874083437}
m_TargetAssemblyTypeName: GameManager, Assembly-CSharp
m_MethodName: GliderButtonClicked
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &526643977
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1409,7 +1421,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 974869914}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1874083437}
m_TargetAssemblyTypeName: GameManager, Assembly-CSharp
m_MethodName: ShrinkButtonClicked
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &974869914
MonoBehaviour:
m_ObjectHideFlags: 0

@ -137,36 +137,17 @@ public class GameManager : MonoBehaviour
private void doPowerupCheck()
{
if (obtainedPowerups.Contains(Powerup.Glider))
{
if (Input.GetKeyDown("1"))
{
var index = Array.IndexOf(obtainedPowerups.ToArray(), Powerup.Glider);
var status = powerupStatus[index];
player.GetComponent<Glider>().IsGliding = !status;
powerupStatus[index] = !status;
}
}
if (obtainedPowerups.Contains(Powerup.HealthUp))
{
player.GetComponent<Health>().maxHealth = 150;
}
//if (obtainedPowerups.Contains(Powerup.Glider))
//{
// if (Input.GetKeyDown("1"))
// {
// var index = Array.IndexOf(obtainedPowerups.ToArray(), Powerup.Glider);
// var status = powerupStatus[index];
// player.GetComponent<Glider>().IsGliding = !status;
// powerupStatus[index] = !status;
// }
//}
if (obtainedPowerups.Contains(Powerup.DoubleJump))
{
player.GetComponent<movement>().maxJumps = 2;
}
if (obtainedPowerups.Contains(Powerup.Shrink))
{
if (Input.GetKeyDown("2"))
{
player.GetComponent<Shrink>().startShrinking();
Debug.Log("Start Shrink Logic");
}
}
}
public GameObject GetPlayer()
@ -228,5 +209,22 @@ public class GameManager : MonoBehaviour
disablePowerup(i);
}
}
public void GliderButtonClicked()
{
Debug.Log("Is Gliding? " + player.GetComponent<Glider>().IsGliding);
player.GetComponent<Glider>().IsGliding = !player.GetComponent<Glider>().IsGliding;
}
public void ShrinkButtonClicked()
{
player.GetComponent<Shrink>().startShrinking();
Debug.Log("Start Shrink Logic");
}
public void DoubleJumpClicked()
{
player.GetComponent<movement>().maxJumps = 2;
}
}

@ -19,8 +19,7 @@ public class HealthUpPowerup : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision)
{
Debug.Log("HealthUp Powerup Obtained");
GameManager.Instance.obtainedPowerups.Add(Powerup.HealthUp);
GameManager.Instance.powerupStatus.Add(false);
GameManager.Instance.player.GetComponent<Health>().maxHealth = 150;
Destroy(gameObject);
}
}

Loading…
Cancel
Save