|
|
|
@ -25,17 +25,17 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
public Sprite[] art;
|
|
|
|
|
public string[] artInfo;
|
|
|
|
|
public GameObject artImage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GameObject powerUps;
|
|
|
|
|
public GameObject gliderPowerupButton;
|
|
|
|
|
public GameObject boxPowerupButton;
|
|
|
|
|
public GameObject doubleJumpPowerupButton;
|
|
|
|
|
public GameObject shrinkPowerupButton;
|
|
|
|
|
public GameObject otherPowerupButton;
|
|
|
|
|
public GameObject powerupText;
|
|
|
|
|
|
|
|
|
|
public GameObject artImage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public GameObject powerUps;
|
|
|
|
|
public GameObject gliderPowerupButton;
|
|
|
|
|
public GameObject boxPowerupButton;
|
|
|
|
|
public GameObject doubleJumpPowerupButton;
|
|
|
|
|
public GameObject shrinkPowerupButton;
|
|
|
|
|
public GameObject otherPowerupButton;
|
|
|
|
|
public GameObject powerupText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private AudioSource sound;
|
|
|
|
@ -72,7 +72,7 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
LoadLevel(sceneToLoad, new Vector3(0, 0, 0));
|
|
|
|
|
}*/
|
|
|
|
|
sound = GetComponent<AudioSource>();
|
|
|
|
|
|
|
|
|
|
GameManager.Instance.enablePowerup(3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
@ -88,6 +88,9 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
sound.Play();
|
|
|
|
|
}
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.Q)){
|
|
|
|
|
ShrinkButtonClicked();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadLevel(string levelName, Vector3 whereTo)
|
|
|
|
@ -146,10 +149,10 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
startButton.SetActive(false);
|
|
|
|
|
title.SetActive(false);
|
|
|
|
|
panel.SetActive(false);
|
|
|
|
|
panel.SetActive(false);
|
|
|
|
|
healthbar.SetActive(true);
|
|
|
|
|
powerUps.SetActive(true);
|
|
|
|
|
disableAllPowerups();
|
|
|
|
|
powerUps.SetActive(true);
|
|
|
|
|
disableAllPowerups();
|
|
|
|
|
LoadLevel(sceneToLoad, new Vector3(0, 0, 0));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -159,48 +162,48 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
return enemyHealthBar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void disablePowerup(int powerupID)
|
|
|
|
|
{
|
|
|
|
|
if (powerupID >= 0 && powerupID <= 4)
|
|
|
|
|
{
|
|
|
|
|
var powerup = powerUps.gameObject.transform.GetChild(powerupID);
|
|
|
|
|
powerup.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void enablePowerup(int powerupID)
|
|
|
|
|
{
|
|
|
|
|
if (powerupID >= 0 && powerupID <= 4)
|
|
|
|
|
{
|
|
|
|
|
var powerup = powerUps.gameObject.transform.GetChild(powerupID);
|
|
|
|
|
powerup.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void disableAllPowerups()
|
|
|
|
|
{
|
|
|
|
|
for(int i=0; i<=4; i++)
|
|
|
|
|
{
|
|
|
|
|
disablePowerup(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GliderButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Is Gliding? " + player.GetComponent<Glider>().IsGliding);
|
|
|
|
|
player.GetComponent<Glider>().ToggleGliding();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShrinkButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
player.GetComponent<Shrink>().startShrinking();
|
|
|
|
|
Debug.Log("Start Shrink Logic");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DoubleJumpClicked()
|
|
|
|
|
{
|
|
|
|
|
player.GetComponent<movement>().maxJumps = 2;
|
|
|
|
|
public void disablePowerup(int powerupID)
|
|
|
|
|
{
|
|
|
|
|
if (powerupID >= 0 && powerupID <= 4)
|
|
|
|
|
{
|
|
|
|
|
var powerup = powerUps.gameObject.transform.GetChild(powerupID);
|
|
|
|
|
powerup.gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void enablePowerup(int powerupID)
|
|
|
|
|
{
|
|
|
|
|
if (powerupID >= 0 && powerupID <= 4)
|
|
|
|
|
{
|
|
|
|
|
var powerup = powerUps.gameObject.transform.GetChild(powerupID);
|
|
|
|
|
powerup.gameObject.SetActive(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void disableAllPowerups()
|
|
|
|
|
{
|
|
|
|
|
for(int i=0; i<=4; i++)
|
|
|
|
|
{
|
|
|
|
|
disablePowerup(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GliderButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Is Gliding? " + player.GetComponent<Glider>().IsGliding);
|
|
|
|
|
player.GetComponent<Glider>().ToggleGliding();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShrinkButtonClicked()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Start Shrink Logic");
|
|
|
|
|
player.GetComponent<Shrink>().startShrinking();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DoubleJumpClicked()
|
|
|
|
|
{
|
|
|
|
|
player.GetComponent<movement>().maxJumps = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|