Browse Source

Initial Commit

Exp bar and Levels.
Rethink ExperienceBar and ToggleMenus scripts
ExpProgression
Shaun Reed 5 years ago
parent
commit
91a7f533a1
  1. 31
      .gitignore
  2. 9
      Assets/Materials.meta
  3. BIN
      Assets/Materials/Cube.mat
  4. 8
      Assets/Materials/Cube.mat.meta
  5. 9
      Assets/Prefabs.meta
  6. BIN
      Assets/Prefabs/Capsule.prefab
  7. 8
      Assets/Prefabs/Capsule.prefab.meta
  8. BIN
      Assets/Prefabs/Cube.prefab
  9. 8
      Assets/Prefabs/Cube.prefab.meta
  10. BIN
      Assets/Prefabs/Cylinder.prefab
  11. 8
      Assets/Prefabs/Cylinder.prefab.meta
  12. BIN
      Assets/Prefabs/Sphere.prefab
  13. 8
      Assets/Prefabs/Sphere.prefab.meta
  14. 9
      Assets/Scenes.meta
  15. BIN
      Assets/Scenes/Main.unity
  16. 8
      Assets/Scenes/Main.unity.meta
  17. 9
      Assets/Scripts.meta
  18. 117
      Assets/Scripts/ExperienceBar.cs
  19. 12
      Assets/Scripts/ExperienceBar.cs.meta
  20. 116
      Assets/Scripts/SpinningCube.cs
  21. 12
      Assets/Scripts/SpinningCube.cs.meta
  22. 175
      Assets/Scripts/ToggleMenus.cs
  23. 12
      Assets/Scripts/ToggleMenus.cs.meta
  24. BIN
      Builds/First.apk
  25. BIN
      ProjectSettings/AudioManager.asset
  26. BIN
      ProjectSettings/ClusterInputManager.asset
  27. BIN
      ProjectSettings/DynamicsManager.asset
  28. BIN
      ProjectSettings/EditorBuildSettings.asset
  29. BIN
      ProjectSettings/EditorSettings.asset
  30. BIN
      ProjectSettings/GraphicsSettings.asset
  31. BIN
      ProjectSettings/InputManager.asset
  32. BIN
      ProjectSettings/NavMeshAreas.asset
  33. BIN
      ProjectSettings/NetworkManager.asset
  34. BIN
      ProjectSettings/Physics2DSettings.asset
  35. BIN
      ProjectSettings/ProjectSettings.asset
  36. 1
      ProjectSettings/ProjectVersion.txt
  37. BIN
      ProjectSettings/QualitySettings.asset
  38. BIN
      ProjectSettings/TagManager.asset
  39. BIN
      ProjectSettings/TimeManager.asset
  40. BIN
      ProjectSettings/UnityAdsSettings.asset
  41. BIN
      ProjectSettings/UnityConnectSettings.asset

31
.gitignore vendored

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
# =============== #
# Unity generated #
# =============== #
Temp/
Library/
# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
ExportedObj/
obj/
*.svd
*.userprefs
/*.csproj
*.pidb
*.suo
/*.sln
*.user
*.unityproj
*.booproj
# ============ #
# OS generated #
# ============ #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

9
Assets/Materials.meta

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 93f0c0b90aab84aa9a74b8e3defe3d29
folderAsset: yes
timeCreated: 1461076928
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Materials/Cube.mat

Binary file not shown.

8
Assets/Materials/Cube.mat.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8f638013a0cfa4a398f00d05518a0b41
timeCreated: 1460724879
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Prefabs.meta

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fa5c4a77f2f968b49a9f41e20228e034
folderAsset: yes
timeCreated: 1479956424
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Capsule.prefab

Binary file not shown.

8
Assets/Prefabs/Capsule.prefab.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4e57775724951a4cb915a7d1af37e74
timeCreated: 1478187092
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Cube.prefab

Binary file not shown.

8
Assets/Prefabs/Cube.prefab.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 00e22d1ed21d14248801d764a0f6a057
timeCreated: 1478187146
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Cylinder.prefab

Binary file not shown.

8
Assets/Prefabs/Cylinder.prefab.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a3ac787c5643744ea61ad4e26781184
timeCreated: 1478187095
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Prefabs/Sphere.prefab

Binary file not shown.

8
Assets/Prefabs/Sphere.prefab.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e73bfacc06717b4dbdb58cbd2c59d0b
timeCreated: 1478187077
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Scenes.meta

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c4224d764d2c54c08b55c7e014ad9c61
folderAsset: yes
timeCreated: 1460724855
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Scenes/Main.unity

Binary file not shown.

8
Assets/Scenes/Main.unity.meta

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 23203d52fcae84949a0ef84a04c62222
timeCreated: 1460724850
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Scripts.meta

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2a6613e3208f248c4b54a3283ef5fe06
folderAsset: yes
timeCreated: 1460724861
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

117
Assets/Scripts/ExperienceBar.cs

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ExperienceBar : MonoBehaviour {
public int Exp = 0;
public string level = "1";
public int nextLevel = 1;
public int Increment = 10;
public GameObject levelText;
public float barWidth;
public float barHeight;
GameObject expBar;
// Eventually.. public RectTransform gainedExp
//Array used as expRequired[leveldesired]
public int[] expRequired = {0,0,100,250,450,700,1000,1350,1700,2150,2650 };
public float clicksNeeded = 10;
float barMovement;
float barPosition;
// Use this for initialization
void Start () {
expBar = this.gameObject;
}
// Update is called once per frame
void Update () {
checkExpGain();
//Check if Exp bar is full
if(this.gameObject.GetComponent<RectTransform>().sizeDelta.x == barWidth || expBar.GetComponent<RectTransform>().sizeDelta.x > barWidth)
{
this.gameObject.GetComponent<RectTransform>().sizeDelta = new Vector3(0, barHeight);
barPosition = 0;
levelText.GetComponent<Text>().text = level;
}
}
public void ExpGain()
{
Exp = Exp + Increment;
//10 clicks per level DIVDED BY clicks required for exp gain
barMovement = 10 / clicksNeeded;
barPosition = barMovement + barPosition;
Debug.Log("barPosition = " + barPosition);
//use time.deltatime to smooth this out to make it look better?
this.gameObject.GetComponent<RectTransform>().sizeDelta = new Vector3(barPosition * 10, barHeight);
}
public void checkExpGain()
{
switch(Exp)
{
case (100):
level = "2";
nextLevel = 3;
clicksNeeded = (expRequired[nextLevel] - Exp)/10;
break;
case (250):
level = "3";
nextLevel = 4;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (450):
level = "4";
nextLevel = 5;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (700):
level = "5";
nextLevel = 6;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (1000):
level = "6";
nextLevel = 7;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (1350):
level = "7";
nextLevel = 8;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (1700):
level = "8";
nextLevel = 9;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (2150):
level = "9";
nextLevel = 10;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
case (2650):
level = "10";
// nextLevel = 10;
clicksNeeded = (expRequired[nextLevel] - Exp) / 10;
break;
}
}
}

12
Assets/Scripts/ExperienceBar.cs.meta

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3512fb1b4f77da34aa574b8675dd5f91
timeCreated: 1503403150
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

116
Assets/Scripts/SpinningCube.cs

@ -0,0 +1,116 @@ @@ -0,0 +1,116 @@
using UnityEngine;
using System.Collections;
public class SpinningCube : MonoBehaviour
{
public float m_Speed = 20f;
public float increments = 10f;
private string RotationDirection = "Up";
private Vector3 m_RotationDirection = Vector3.up;
private Vector3 stopRotation = Vector3.zero;
private Vector3 tempRotation;
public void ToggleRotationDirection()
{
if (m_RotationDirection == Vector3.up)
{
m_RotationDirection = Vector3.down;
RotationDirection = "Down";
}
else
{
m_RotationDirection = Vector3.up;
RotationDirection = "Up";
}
Debug.Log("Toggled rotation direction: " + RotationDirection);
}
public void ToggleRotation()
{
Debug.Log("Stopping Rotation. Last known rotation direction: " + RotationDirection);
stopRotation = Vector3.zero;
if (m_RotationDirection == stopRotation)
{
m_RotationDirection = tempRotation;
}
else {
tempRotation = m_RotationDirection;
m_RotationDirection = stopRotation;
}
}
public void RaiseRotationSpeed()
{
m_Speed = m_Speed + increments;
Debug.Log("Rotation Speed: " + m_Speed);
}
public void LowerRotationSpeed()
{
m_Speed = m_Speed - increments;
Debug.Log("Rotation Speed: " + m_Speed);
}
public void ResetRotationSpeed()
{
m_Speed = 20.0f;
Debug.Log("Rotation Speed Reset");
}
public void ChangeColorWhite()
{
GameObject.FindGameObjectsWithTag("Player");
gameObject.GetComponent<Renderer>().material.color = Color.white;
}
public void ChangeColorBlue()
{
gameObject.GetComponent<Renderer>().material.color = Color.blue;
}
public void ChangeColorBlack()
{
gameObject.GetComponent<Renderer>().material.color = Color.black;
}
public void ChangeColorGreen()
{
gameObject.GetComponent<Renderer>().material.color = Color.green;
}
public void ChangeColorRed()
{
gameObject.GetComponent<Renderer>().material.color = Color.red;
}
public void ChangeColorMagenta()
{
gameObject.GetComponent<Renderer>().material.color = Color.magenta;
}
public void ChangeColorYellow()
{
gameObject.GetComponent<Renderer>().material.color = Color.yellow;
}
public void ChangeColorCyan()
{
gameObject.GetComponent<Renderer>().material.color = Color.cyan;
}
void Update()
{
transform.Rotate(m_RotationDirection * Time.deltaTime * m_Speed);
}
}

12
Assets/Scripts/SpinningCube.cs.meta

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f3f0c4784be6c460585c1b77fb5cf8bf
timeCreated: 1461145580
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

175
Assets/Scripts/ToggleMenus.cs

@ -0,0 +1,175 @@ @@ -0,0 +1,175 @@
using UnityEngine;
using System.Collections;
public class ToggleMenus : MonoBehaviour
{
public GameObject RotMenu;
public GameObject ColorMenu;
public GameObject ShapesMenu;
public GameObject LightingMenu;
public GameObject ExpMenu;
public GameObject Square;
public GameObject Sphere;
public GameObject Cylinder;
public GameObject Capsule;
public GameObject Temp;
public GameObject mySpawn;
private string Spawn = "Spawn";
private string Active = "Cube";
private bool ActiveMenu = false;
// Use this for initialization
void Start()
{
Temp = Square;
}
public void ToggleRotationMenu()
{
if (RotMenu.gameObject.active)
{
RotMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu;
}
else if (!RotMenu.gameObject.active && ActiveMenu)
{
CloseAll();
RotMenu.gameObject.SetActive(true);
}
else
{
RotMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu;
}
}
public void ToggleColorMenu()
{
if (ColorMenu.gameObject.active)
{
ColorMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu;
}
else if (!ColorMenu.gameObject.active && ActiveMenu)
{
CloseAll();
ColorMenu.gameObject.SetActive(true);
}
else
{
ColorMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu;
}
}
public void ToggleShapesMenu()
{
if (ShapesMenu.gameObject.active)
{
ShapesMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu;
}
else if (!ShapesMenu.gameObject.active && ActiveMenu)
{
CloseAll();
ShapesMenu.gameObject.SetActive(true);
}
else
{
ShapesMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu;
}
}
public void ToggleLightingMenu()
{
if (LightingMenu.gameObject.active)
{
LightingMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu;
}
else if (!LightingMenu.gameObject.active && ActiveMenu)
{
CloseAll();
LightingMenu.gameObject.SetActive(true);
}
else
{
LightingMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu;
}
}
public void ToggleExpMenu()
{
if (ExpMenu.gameObject.active)
{
ExpMenu.gameObject.SetActive(false);
//check if another menu is open to avoid overlapping
ActiveMenu = !ActiveMenu;
}
else if (!ExpMenu.gameObject.active && ActiveMenu)
{
CloseAll();
ExpMenu.gameObject.SetActive(true);
}
else
{
ExpMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu;
}
}
public void CloseAll()
{
ShapesMenu.gameObject.SetActive(false);
RotMenu.gameObject.SetActive(false);
ColorMenu.gameObject.SetActive(false);
LightingMenu.gameObject.SetActive(false);
ExpMenu.gameObject.SetActive(false);
}
public void ChangeShapeSquare()
{
Instantiate(Square, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Cube(Clone)";
Debug.Log(Active);
}
public void ChangeShapeSphere()
{
Instantiate(Sphere, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Sphere(Clone)";
Debug.Log(Active);
}
public void ChangeShapeCapsule()
{
Instantiate(Capsule, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Capsule(Clone)";
Debug.Log(Active);
}
public void ChangeShapeCylinder()
{
Instantiate(Cylinder, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Cylinder(Clone)";
Debug.Log(Active);
}
}

12
Assets/Scripts/ToggleMenus.cs.meta

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9e370590024e5584cbd068cab625f69b
timeCreated: 1478116406
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Builds/First.apk

Binary file not shown.

BIN
ProjectSettings/AudioManager.asset

Binary file not shown.

BIN
ProjectSettings/ClusterInputManager.asset

Binary file not shown.

BIN
ProjectSettings/DynamicsManager.asset

Binary file not shown.

BIN
ProjectSettings/EditorBuildSettings.asset

Binary file not shown.

BIN
ProjectSettings/EditorSettings.asset

Binary file not shown.

BIN
ProjectSettings/GraphicsSettings.asset

Binary file not shown.

BIN
ProjectSettings/InputManager.asset

Binary file not shown.

BIN
ProjectSettings/NavMeshAreas.asset

Binary file not shown.

BIN
ProjectSettings/NetworkManager.asset

Binary file not shown.

BIN
ProjectSettings/Physics2DSettings.asset

Binary file not shown.

BIN
ProjectSettings/ProjectSettings.asset

Binary file not shown.

1
ProjectSettings/ProjectVersion.txt

@ -0,0 +1 @@ @@ -0,0 +1 @@
m_EditorVersion: 2017.1.0f3

BIN
ProjectSettings/QualitySettings.asset

Binary file not shown.

BIN
ProjectSettings/TagManager.asset

Binary file not shown.

BIN
ProjectSettings/TimeManager.asset

Binary file not shown.

BIN
ProjectSettings/UnityAdsSettings.asset

Binary file not shown.

BIN
ProjectSettings/UnityConnectSettings.asset

Binary file not shown.
Loading…
Cancel
Save