Skip to content
Snippets Groups Projects
Commit 47b84fe7 authored by Will's avatar Will
Browse files

Criada classes com modificadores pra cada dificuldade

parent 12954d8a
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,8 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class MenuManager : MonoBehaviour {
public class MenuManager : MonoBehaviour
{
private Text level;
private Text turnDuration;
private Text maxPoints;
......@@ -31,11 +31,6 @@ public class MenuManager : MonoBehaviour {
}
}
// Update is called once per frame
void Update () {
}
public void quit()
{
Application.Quit();
......@@ -45,7 +40,7 @@ public class MenuManager : MonoBehaviour {
{
Debug.Log(SettingsPersistance.INSTANCE.turnDuration);
Debug.Log(SettingsPersistance.INSTANCE.maxPoints);
Debug.Log(SettingsPersistance.INSTANCE.level);
Debug.Log(SettingsPersistance.INSTANCE.difficulty);
SceneManager.LoadScene(scene);
}
......@@ -56,15 +51,15 @@ public class MenuManager : MonoBehaviour {
if (level.text == "Normal")
{
SettingsPersistance.INSTANCE.level = Level.normal;
SettingsPersistance.INSTANCE.difficulty = new Normal();
}
else if (level.text == "Dificil")
{
SettingsPersistance.INSTANCE.level = Level.dificil;
SettingsPersistance.INSTANCE.difficulty = new Hard();
}
else
{
SettingsPersistance.INSTANCE.level = Level.facil;
SettingsPersistance.INSTANCE.difficulty = new Easy();
}
}
}
......@@ -6,7 +6,7 @@ public class SettingsPersistance : MonoBehaviour
{
public static SettingsPersistance INSTANCE;
[HideInInspector] public Level level;
[HideInInspector] public Difficulty difficulty;
[HideInInspector] public int turnDuration;
[HideInInspector] public int maxPoints;
......@@ -28,15 +28,82 @@ public class SettingsPersistance : MonoBehaviour
private void defaultValues()
{
level = Level.facil;
difficulty = new Easy();
turnDuration = 8;
maxPoints = 3;
}
}
public enum Level
public abstract class Difficulty
{
facil,
normal,
dificil
protected float costModifier;
protected float speed;
protected float jumpForce;
protected float force;
protected float maxStamina;
protected float speedModifier;
public float getCostModifier()
{
return costModifier;
}
public float getSpeed()
{
return speed;
}
public float getJumpForce()
{
return jumpForce;
}
public float getForce()
{
return force;
}
public float getMaxStamina()
{
return maxStamina;
}
public float getSpeedModifier()
{
return speedModifier;
}
}
public class Easy : Difficulty
{
public Easy()
{
costModifier = 1;
speed = 4;
jumpForce = 5;
force = 0.8f;
maxStamina = 20;
speedModifier = 2;
}
}
public class Normal : Difficulty
{
public Normal()
{
costModifier = 2;
speed = 3;
jumpForce = 4;
force = 0.8f;
maxStamina = 15;
speedModifier = 1.5f;
}
}
public class Hard : Difficulty
{
public Hard()
{
costModifier = 3;
speed = 2;
jumpForce = 3;
force = 0.5f;
maxStamina = 15;
speedModifier = 1.2f;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment