Fixed Formatting
Removed unused variables Added Save() to OnDestroy() within all scripts related to PlayerData
This commit is contained in:
parent
a339149a71
commit
90948610cd
Binary file not shown.
|
@ -4,16 +4,14 @@ using UnityEngine.UI;
|
|||
|
||||
|
||||
public class ExperienceBar : MonoBehaviour {
|
||||
// Eventually.. public RectTransform gainedExp
|
||||
//Array used as expRequired[leveldesired]
|
||||
|
||||
|
||||
//playerdata - needs saved
|
||||
//Playerdata -- Needs saved
|
||||
public int currentLevel = 1;
|
||||
public float currentExp = 0;
|
||||
public float currentRequirement = 100;
|
||||
public GameObject currentLevelText;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject currentLevelText;
|
||||
[SerializeField]
|
||||
private float fillAmount;
|
||||
[SerializeField]
|
||||
|
@ -34,6 +32,11 @@ public class ExperienceBar : MonoBehaviour {
|
|||
fillAmount = currentExp / currentRequirement;
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>().Save();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
fillAmount = currentExp / currentRequirement;
|
||||
|
|
|
@ -20,17 +20,17 @@ public class GameManager : MonoBehaviour {
|
|||
public float increment;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
Load();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
Load();
|
||||
|
@ -67,7 +67,6 @@ public class GameManager : MonoBehaviour {
|
|||
bf.Serialize(file, data);
|
||||
file.Close();
|
||||
Debug.Log("Saved");
|
||||
|
||||
}
|
||||
|
||||
public void Load()
|
||||
|
@ -85,11 +84,6 @@ public class GameManager : MonoBehaviour {
|
|||
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentExp = data.experience;
|
||||
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentRequirement = data.requirement;
|
||||
Debug.Log("Loaded");
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,11 @@ public class SpinningCube : MonoBehaviour
|
|||
[SerializeField]
|
||||
private int rotations;
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>().Save();
|
||||
}
|
||||
|
||||
public void ToggleRotationDirection()
|
||||
{
|
||||
|
||||
|
@ -35,6 +40,7 @@ public class SpinningCube : MonoBehaviour
|
|||
RotationDirection = "Up";
|
||||
}
|
||||
Debug.Log("Toggled rotation direction: " + RotationDirection);
|
||||
|
||||
}
|
||||
|
||||
public void ToggleRotation()
|
||||
|
@ -55,14 +61,12 @@ public class SpinningCube : MonoBehaviour
|
|||
public void RaiseRotationSpeed()
|
||||
{
|
||||
currentSpeed = currentSpeed + currentIncrement;
|
||||
|
||||
Debug.Log("Rotation Speed: " + currentSpeed);
|
||||
}
|
||||
|
||||
public void LowerRotationSpeed()
|
||||
{
|
||||
currentSpeed = currentSpeed - currentIncrement;
|
||||
|
||||
Debug.Log("Rotation Speed: " + currentSpeed);
|
||||
}
|
||||
|
||||
|
@ -126,7 +130,7 @@ public class SpinningCube : MonoBehaviour
|
|||
//rotations += (int)(m_Speed / 360);
|
||||
|
||||
//if object is rotating, and angle difference is less than 0
|
||||
//If object has rotated 20 degrees (m_speed = 20), when angle1 = 350, && angle2 = 10
|
||||
//If object has rotated 20 degrees (currentSpeed = 20), when angle1 = 350, && angle2 = 10
|
||||
//angle2(10)-angle1(350) = -340
|
||||
//Object has rotated past 360
|
||||
if ((currentSpeed > 0) && (angledif < 0))
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class ToggleMenus : MonoBehaviour
|
||||
{
|
||||
|
||||
//Menus
|
||||
public GameObject RotMenu;
|
||||
public GameObject ColorMenu;
|
||||
public GameObject ShapesMenu;
|
||||
public GameObject LightingMenu;
|
||||
public GameObject ExpMenu;
|
||||
|
||||
private bool ActiveMenu = false;
|
||||
|
||||
//Shapes - Prefabs
|
||||
public GameObject Square;
|
||||
public GameObject Sphere;
|
||||
public GameObject Cylinder;
|
||||
|
@ -17,16 +21,30 @@ public class ToggleMenus : MonoBehaviour
|
|||
public GameObject Temp;
|
||||
public GameObject mySpawn;
|
||||
|
||||
|
||||
private string Spawn = "Spawn";
|
||||
private string Active = "Cube";
|
||||
private bool ActiveMenu = false;
|
||||
|
||||
//Use with lighting menu
|
||||
//private GameObject lighting = GameObject.FindGameObjectWithTag("Lighting");
|
||||
|
||||
public float lightRotX, lightRotY, lightRotZ;
|
||||
public GameObject[] buttons;
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
Temp = Square;
|
||||
lightRotX = 0;
|
||||
lightRotY = 0;
|
||||
lightRotZ = 0;
|
||||
EditLightingRotation();
|
||||
//EditLightingLocation();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
GameObject.FindGameObjectWithTag("Lighting").transform.Rotate(lightRotX, lightRotY, lightRotZ);
|
||||
}
|
||||
|
||||
public void ToggleRotationMenu()
|
||||
|
@ -133,7 +151,6 @@ public class ToggleMenus : MonoBehaviour
|
|||
ColorMenu.gameObject.SetActive(false);
|
||||
LightingMenu.gameObject.SetActive(false);
|
||||
ExpMenu.gameObject.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void ChangeShapeSquare()
|
||||
|
@ -172,4 +189,51 @@ public class ToggleMenus : MonoBehaviour
|
|||
Debug.Log(Active);
|
||||
}
|
||||
|
||||
public void EditLightingRotation()
|
||||
{
|
||||
buttons = GameObject.FindGameObjectsWithTag("RotationMenuButtons");
|
||||
foreach (Object button in buttons)
|
||||
{
|
||||
gameObject.GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
}
|
||||
|
||||
GameObject.Find("X Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationX(); });
|
||||
GameObject.Find("Y Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationY(); });
|
||||
GameObject.Find("Z Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationZ(); });
|
||||
}
|
||||
|
||||
public void EditLightingLocation()
|
||||
{
|
||||
buttons = GameObject.FindGameObjectsWithTag("RotationMenuButtons");
|
||||
foreach (Object button in buttons)
|
||||
{
|
||||
gameObject.GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
}
|
||||
//
|
||||
//CHANGE THESE TO LOCATION NOT ROTATION
|
||||
//
|
||||
GameObject.Find("X Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationX(); });
|
||||
GameObject.Find("Y Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationY(); });
|
||||
GameObject.Find("Z Button").GetComponent<Button>().onClick.AddListener(() => { EditLightingRotationZ(); });
|
||||
}
|
||||
|
||||
public void EditLightingLocationX()
|
||||
{
|
||||
//lightRotX = 20 * Time.deltaTime;
|
||||
}
|
||||
|
||||
public void EditLightingRotationX()
|
||||
{
|
||||
lightRotX = 20 * Time.deltaTime;
|
||||
}
|
||||
|
||||
public void EditLightingRotationY()
|
||||
{
|
||||
lightRotY = 20 * Time.deltaTime;
|
||||
}
|
||||
|
||||
public void EditLightingRotationZ()
|
||||
{
|
||||
lightRotZ = 20 * Time.deltaTime;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue