Compare commits

...

15 Commits

Author SHA1 Message Date
Shaun Reed 85c0d5fffe Add screenshot to README, fix EXP bar sprite scaling 2020-11-23 16:54:08 -05:00
Shaun Reed c6dca3c458 README update 2019-08-24 04:32:29 -04:00
Shaun Reed aebbc25002
Added readme information
For decreasing the fluff text on the website, and explaining this project on github.
2018-11-25 11:41:14 -05:00
Shaun Reed 20ff747b7b Fixed changing shapes
- Changing shapes no longer breaks menu functions
- Moved all Change...() functions related to Player in SpinningCube.cs
to ToggleMenus.cs script
-- Add saving needed data
--Color, shape (Speed between shapes, etc..)

-Created two new functions to replace 10+ small functions with switch
case
-ChangeShape(string shape) & ChangeColor(string color)
2017-09-06 20:05:59 -04:00
Shaun Reed 22c303d686 improvements to notifications
Handles popup collision
-Levelups tossed to the left
-Exp values combined into one popup
--Add EXP/s or EXP/min?
2017-09-05 21:41:56 -04:00
Shaun Reed 1bcca0e925 Reworked (bad)notification system
- Reduced huge amount of fluff logic, loops, conditionals
- Fixed infinite loop within 4+ calls to SendNotification()
-- Replaced with new function MakePopup(string contents)
-- Spawns a prefab, can call as much as you want (overlapping issue)
-Add combining of colliding Popups with similar contents (exp)
-- Add a tag passed into MakePopup() as argument used to combine similar
values ( and increase time left to Destroy(), raise speed of transform
to move away from other popups)
- Popups rotate within a range of -4 to 4 for trendy not-perfect look
*shrug*
2017-09-05 18:12:08 -04:00
Shaun Reed 33664d2735 Added basic notification system
-Works with minimal calls to SendNotification(), infinite loop possible
on multiple calls
-Add to MoreExp()
--Add case for multiple notifications of same type combining value
--If notification timer > maxTime
---expRate = expNotifyValue / secondsPassed
---Display Exp/s instead of continuously growing value
2017-09-04 19:53:18 -04:00
Shaun Reed cc86eabeef Fixed LevelUp()
-No longer resets exp to 0, limiting to one level per AFK
--Instead, { currentExp -= previousRequirement; }
2017-09-04 15:30:19 -04:00
Shaun Reed a04e1e1225 Fixed idleExp not working on android
Fixed idleExp only working through unity editor, now works on
application built to an android device through OnApplicationFocus()
2017-09-04 14:56:21 -04:00
Shaun Reed 0bae48932e Excluded file from last commit
Forgot one!
- Adds rotationPerSec & secPerRotation
2017-09-04 13:55:53 -04:00
Shaun Reed c868d738b9 Improved scripting
-Added accurate rotationPerSec & secondPerRot values!... Up to a speed
of ~720.
--Used for new idle expgain calculation in Load()
-Added scripting for assigning button events within
InitializeButtonArrays()
--stored all buttons to arrays depending on contents of the parent UI
panel's name
--mainButtons[], rotationButtons[], colorButtons[]... etc
--Future buttons will automatically exist within the array, only events
need assigning.
--Buttons do not include tick boxes, etc!
--Buttons cannot have onClick() even assigned through editor (Unity
bug?)
2017-09-04 13:53:03 -04:00
Shaun Reed ea55db656d Added experience gain while idle
- Might be off, could understand radians better
- Add popup for displaying idle exp gained
2017-09-03 21:46:47 -04:00
Shaun Reed 90948610cd Fixed Formatting
Removed unused variables
Added Save() to OnDestroy() within all scripts related to PlayerData
2017-09-03 19:47:23 -04:00
Shaun Reed a339149a71 Added saving and loading
Added PlayerData class to GamerManager.cs
- Stored in Application.PersistantDataPath + "/playerInfo.dat"
- Safer way to store / transfer data?
- Add saving of local time when calling Save() or Load()
- Compare save time to load time and give afk rewards earned based on
rotation speed
2017-09-03 18:56:05 -04:00
Shaun Reed f20d8340bb Added rotation count
Added rotation count to SpinningCube.cs
-Change increment to change amount of speed added per level
2017-09-03 15:58:42 -04:00
38 changed files with 1134 additions and 189 deletions

Binary file not shown.

Binary file not shown.

View File

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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View File

@ -0,0 +1,152 @@
fileFormatVersion: 2
guid: 4fe29e11b36d63d4bbddcaa4ef2409cb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Windows Store Apps
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 28a82baf8aadfa844a76fc5dd71094f8
timeCreated: 1504643709
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e37a904fb373d0244a3345167006b83d
timeCreated: 1504644537
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4cf0708b040fc2c4aa29a200bec6056f
timeCreated: 1504644516
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: acc04bbf04d68f24fa01177bb3ed86b8
timeCreated: 1504644530
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3296a1925269b9c4699c0f4de17d0366
timeCreated: 1504644532
licenseType: Free
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Binary file not shown.

View File

@ -4,39 +4,49 @@ using UnityEngine.UI;
public class ExperienceBar : MonoBehaviour { public class ExperienceBar : MonoBehaviour {
// Eventually.. public RectTransform gainedExp
//Array used as expRequired[leveldesired] //Playerdata -- Needs saved
public int currentLevel = 1;
public float currentExp = 0;
public float currentRequirement = 100;
[SerializeField] [SerializeField]
private int level = 1; private GameObject currentLevelText;
[SerializeField]
private float expObtained = 0;
[SerializeField]
private float expRequired = 100;
[SerializeField] [SerializeField]
private float fillAmount; private float fillAmount;
[SerializeField] [SerializeField]
private GameObject levelText;
[SerializeField]
private Image expBarSprite; private Image expBarSprite;
[SerializeField] [SerializeField]
private float lerpSpeed; private float lerpSpeed;
[SerializeField] [SerializeField]
private int clicks; private int clicks;
[SerializeField]
private GameObject eventSystem;
private float clicksNeeded = 10; private float clicksNeeded = 10;
private float previousExpRequired; private float previousExpRequired;
private float barMovement; private float barMovement;
private float barPosition; private float barPosition;
private float Increment = 10; [SerializeField]
public float expIncrement = 10.0f;
private string notify;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
fillAmount = 0; eventSystem = GameObject.Find("EventSystem");
fillAmount = currentExp / currentRequirement;
} }
// Update is called once per frame // Update is called once per frame
void Update () { void Update () {
fillAmount = currentExp / currentRequirement;
this.gameObject.GetComponentInChildren<Text>().text = (int)currentExp + " / " + (int)currentRequirement;
if (currentLevelText.GetComponent<Text>().text != currentLevel.ToString()){
currentLevelText.GetComponent<Text>().text = currentLevel.ToString();
}
if (fillAmount != expBarSprite.fillAmount) if (fillAmount != expBarSprite.fillAmount)
{ {
@ -47,7 +57,7 @@ public class ExperienceBar : MonoBehaviour {
if (expBarSprite.fillAmount >= 1.0f) if (expBarSprite.fillAmount >= 1.0f)
{ {
LevelUp(); LevelUp();
clicksNeeded = (expRequired - expObtained) / Increment; clicksNeeded = (currentRequirement - currentExp) / expIncrement;
fillAmount = 0; fillAmount = 0;
} }
} }
@ -55,37 +65,60 @@ public class ExperienceBar : MonoBehaviour {
public void ExpMore() public void ExpMore()
{ {
++clicks; ++clicks;
expObtained = expObtained + Increment; currentExp = currentExp + expIncrement;
fillAmount = (expObtained / expRequired); fillAmount = currentExp / currentRequirement;
Debug.Log("fillAmount = " + fillAmount); notify = "+" + expIncrement + "EXP";
eventSystem.GetComponent<GameManager>().RewardPopup(expIncrement, 1);
//Debug.Log("fillAmount = " + fillAmount);
} }
public void LevelUp() public void LevelUp()
{ {
++level; ++currentLevel;
levelText.GetComponent<Text>().text = level.ToString(); expIncrement += 10;
previousExpRequired = expRequired; currentLevelText.GetComponent<Text>().text = currentLevel.ToString();
expObtained = 0; previousExpRequired = currentRequirement;
expRequired = Mathf.Pow(expRequired, 1.05f); currentExp -= previousExpRequired;
currentRequirement = Mathf.Pow(currentRequirement, 1.05f);
GameObject.Find("Main Panel").GetComponent<ToggleMenus>().RaiseRotationSpeed();
notify = "Level " + currentLevel + "!";
eventSystem.GetComponent<GameManager>().RewardPopup(currentLevel, 2);
} }
public void ResetExp() public void ResetExp()
{ {
level = 1; currentLevel = 1;
levelText.GetComponent<Text>().text = level.ToString(); currentLevelText.GetComponent<Text>().text = currentLevel.ToString();
currentExp = 0;
fillAmount = 0; fillAmount = 0;
expObtained = 0; expIncrement = 10.0f;
expRequired = 100; currentRequirement = 100;
clicksNeeded = 10; clicksNeeded = 10;
clicks = 0; clicks = 0;
notify = "EXP Reset";
eventSystem.GetComponent<GameManager>().MakeStringPopup(notify, 1);
} }
public void ExpLess() public void ExpLess()
{ {
--clicks; --clicks;
expObtained = expObtained - Increment; currentExp = currentExp - expIncrement;
fillAmount = (expObtained / expRequired); fillAmount = (currentExp / currentRequirement);
Debug.Log("fillAmount = " + fillAmount); Debug.Log("fillAmount = " + fillAmount);
notify = "-" + expIncrement + "EXP";
eventSystem.GetComponent<GameManager>().RewardPopup(-expIncrement, 1);
} }
public float GetExperience()
{
float currentExp;
currentExp = this.currentExp;
return currentExp;
}
} }

View File

@ -0,0 +1,167 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
public class GameManager : MonoBehaviour {
//Used to save playerdata
//Serializable tells unity it can save to a file
[Serializable]
private class PlayerData
{
public int level;
public float experience;
public float requirement;
public float speed;
public float speedIncrement;
public float expIncrement;
public float rotationsPerSec;
public DateTime currentTime;
}
public float idleExp;
public GameObject popup;
public GameObject popupSpawn;
public string notify;
void OnApplicationFocus(bool pauseStatus)
{
Debug.Log("OnApplicationFocused");
if (pauseStatus)
{
//your app is NO LONGER in the background
Load();
}
else
{
//your app is now in the background
Save();
}
}
void OnApplicationQuit()
{
Save();
}
public void Save()
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat");
int currentLevel = GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentLevel;
float currentExp = GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentExp;
float currentRequirement = GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentRequirement;
float rotationPerSec = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().rotationPerSec;
float currentSpeed = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed;
float currentIncrement = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentIncrement;
float currentExpIncrement = GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().expIncrement;
PlayerData data = new PlayerData();
data.level = currentLevel;
data.experience = currentExp;
data.requirement = currentRequirement;
data.speed = currentSpeed;
data.speedIncrement = currentIncrement;
data.expIncrement = currentExpIncrement;
data.rotationsPerSec = rotationPerSec;
data.currentTime = System.DateTime.Now;
bf.Serialize(file, data);
file.Close();
Debug.Log("Saved");
}
public void Load()
{
if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
PlayerData data = (PlayerData)bf.Deserialize(file);
file.Close();
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().rotationPerSec = data.rotationsPerSec;
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed = data.speed;
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentIncrement = data.speedIncrement;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().expIncrement = data.expIncrement;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentLevel = data.level;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentExp = data.experience;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentRequirement = data.requirement;
DateTime loadTime = System.DateTime.Now;
int secondsPassed = GetIdleTime(data.currentTime, loadTime);
idleExp = (data.rotationsPerSec * secondsPassed) * data.expIncrement;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().currentExp += idleExp;
if (idleExp >= 0.0f)
{
RewardPopup(idleExp, 1);
}
Debug.Log("Loaded");
Debug.Log("idleExp: " + idleExp);
}
}
public int GetIdleTime(DateTime saveTime, DateTime loadTime)
{
int daysPassed = 0;
int hoursPassed = 0;
int minutesPassed = 0;
int secondsPassed = 0;
for (int monthSaved = saveTime.Month; monthSaved < loadTime.Month; ++monthSaved)
{
daysPassed += 30;
}
daysPassed += loadTime.Day - saveTime.Day;
hoursPassed = daysPassed * 24;
hoursPassed += loadTime.Hour - saveTime.Hour;
minutesPassed = hoursPassed * 60;
minutesPassed += loadTime.Minute - saveTime.Minute;
secondsPassed = minutesPassed * 60;
secondsPassed += loadTime.Second - saveTime.Second;
Debug.Log("Seconds Passed: " + secondsPassed);
return secondsPassed;
}
public int notificationType;
public float noteValue;
/*
* type 1 = exp
* type 2 = level
*
*
*
*
*/
public void RewardPopup(float value, int type)
{
notificationType = type;
noteValue = value;
Instantiate(popup, popupSpawn.transform.position, popupSpawn.transform.rotation, GameObject.Find("Notification Panel").gameObject.transform );
Debug.Log("Popup Created");
}
public void MakeStringPopup(string content, int type)
{
notify = content;
notificationType = type;
Instantiate(popup, popupSpawn.transform.position, popupSpawn.transform.rotation, GameObject.Find("Notification Panel").gameObject.transform);
Debug.Log("Popup Created");
}
}

View File

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

View File

@ -0,0 +1,151 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PopupNotification : MonoBehaviour {
public bool move = false;
public bool active = false;
public Vector3 origin;
public float timer = 0.0f;
public float maxTimer = 3.0f;
public float speed = 50.0f;
public string localNotify;
public int notificationType;
public float localValue;
// Use this for initialization
void OnEnable ()
{
active = true;
//Get & set random rotation
double randomRotation = GetRandomNumber(-4.0, 4.0);
transform.Rotate(0.0f, 0.0f, (float)randomRotation);
//Debug.Log("Rotation set to :" + randomRotation);
//
notificationType = GameObject.Find("EventSystem").GetComponent<GameManager>().notificationType;
//localNotify = GameObject.Find("EventSystem").GetComponent<GameManager>().notify;
localValue = GameObject.Find("EventSystem").GetComponent<GameManager>().noteValue;
CheckNotificationType();
}
// Update is called once per frame
void FixedUpdate()
{
timer += 0.02f;
if (timer >= maxTimer)
{
active = false;
timer = 0.0f;
Destroy(this.gameObject);
}
if(move == true)
{
this.gameObject.transform.Translate(new Vector3(-5.0f, speed * Time.deltaTime, 0));
this.gameObject.GetComponentInChildren<Text>().text = localNotify;
}
else
{
this.gameObject.transform.Translate(new Vector3(0, speed * Time.deltaTime, 0));
this.gameObject.GetComponentInChildren<Text>().text = localNotify;
}
}
void OnCollisionEnter (Collision col)
{
if(col.gameObject.GetComponent<PopupNotification>().notificationType == 1 && notificationType == 1)
{
//if both colliding popus are EXP related
if ((maxTimer - timer) > (col.gameObject.GetComponent<PopupNotification>().maxTimer - col.gameObject.GetComponent<PopupNotification>().timer))
{
//If this Popup has more time left than colliding popup
localValue += col.gameObject.GetComponent<PopupNotification>().localValue;
maxTimer += 0.5f;
CheckNotificationType();
Destroy(col.gameObject);
}//else do nothing, let other popup handle it
}
else if (col.gameObject.GetComponent<PopupNotification>().notificationType == 2 && notificationType == 2)
{
//if both colliding popus are level related
if (localValue > col.gameObject.GetComponent<PopupNotification>().localValue)
{
//If this popup is of higher level
Destroy(col.gameObject);
}//Destroy collider, show most recent level
maxTimer += 1.0f;
CheckNotificationType();
}
else if (col.gameObject.GetComponent<PopupNotification>().notificationType != notificationType)
{
//if both colliding popus are not related
if (notificationType == 2)
{
move = true;
}//else do nothing, let other popup handle it
}
}
public double GetRandomNumber(double min, double max)
{
System.Random random = new System.Random();
return random.NextDouble() * (max - min) + min;
}
public void CheckNotificationType()
{
//If notification is of type EXP
if (notificationType == 1)
{
if (localValue == 0)
{
Debug.Log("Null EXP value, popup discarded :" + localValue);
Destroy(this.gameObject);
}
if (localValue > 0)
{
//If adding EXP
localNotify = "+" + localValue + "EXP";
}
else if (localValue < 0)
{
//If subtracting EXP
localNotify = localValue + "EXP";
}
}
else if (notificationType == 2)
{
//If notification is of type Level Gained
localNotify = "Level " + localValue + "!";
}
this.gameObject.GetComponentInChildren<Text>().text = localNotify;
}
}

View File

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

View File

@ -1,116 +1,80 @@
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using System.Collections; using System.Collections;
public class SpinningCube : MonoBehaviour public class SpinningCube : MonoBehaviour
{ {
public float m_Speed = 20f;
public float increments = 10f; //Playerdata -- Needs saved
public float currentSpeed = 20f;
public float currentIncrement = 20f;
public float rotationPerSec = 0.0f;
private string RotationDirection = "Up"; public string RotationDirection = "Up";
private Vector3 m_RotationDirection = Vector3.up; public Vector3 m_RotationDirection = Vector3.up;
private Vector3 stopRotation = Vector3.zero; public Vector3 rotationOrigin;
private Vector3 tempRotation; public Vector3 stopRotation = Vector3.zero;
public Vector3 tempRotation;
public float angle2 = 0;
public float angledif, angle1;
public float angleSum = 0;
[SerializeField]
public float secPerRotation = 0.0f;
[SerializeField]
public float lastRPS = 0.0f;
public void ToggleRotationDirection() [SerializeField]
{ public float secondsPassed = 0.0f;
if (m_RotationDirection == Vector3.up) [SerializeField]
{ public int rotations;
m_RotationDirection = Vector3.down;
RotationDirection = "Down";
}
else
{
m_RotationDirection = Vector3.up;
RotationDirection = "Up";
}
Debug.Log("Toggled rotation direction: " + RotationDirection);
}
public void ToggleRotation() public void Start()
{
/*
if(GameObject.Find("Rotation Panel").activeSelf)
{ {
Debug.Log("Stopping Rotation. Last known rotation direction: " + RotationDirection); GameObject.Find("Rotation Direction Button").GetComponent<Button>().onClick.AddListener(() => { ToggleRotationDirection(); });
stopRotation = Vector3.zero;
if (m_RotationDirection == stopRotation)
{
m_RotationDirection = tempRotation;
}
else {
tempRotation = m_RotationDirection;
m_RotationDirection = stopRotation;
}
} }
*/
}
void FixedUpdate()
{
//Set angle1 = eulerAngle of axis being rotated prior to applying rotation
angle1 = this.gameObject.transform.rotation.eulerAngles.y;
transform.Rotate(m_RotationDirection * Time.deltaTime * currentSpeed);
//angle2 = eulerAngle of axis after rotation applied
angle2 = this.gameObject.transform.rotation.eulerAngles.y;
//Difference between angle2 and angle1, how much the object rotated between frames
angledif = angle2 - angle1;
secondsPassed += 0.02f;
//rotations += (int)(m_Speed / 360);
public void RaiseRotationSpeed() //if object is rotating, and angle difference is less than 0
//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))
{ {
m_Speed = m_Speed + increments; ++rotations;
GameObject.FindGameObjectWithTag("ExpGained").GetComponent<ExperienceBar>().ExpMore();
Debug.Log("Rotation Speed: " + m_Speed); lastRPS = 1 / secondsPassed;
if(rotationPerSec != lastRPS)
{
rotationPerSec = lastRPS;
secPerRotation = secondsPassed;
Debug.Log("Rotations Per Second: " + rotationPerSec);
}
secondsPassed = 0.0f;
} }
}
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);
}
} }

View File

@ -1,87 +1,113 @@
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using System.Collections; using System.Collections;
using System.Collections.Generic;
public class ToggleMenus : MonoBehaviour public class ToggleMenus : MonoBehaviour
{ {
//Menus
public GameObject rotMenu;
public GameObject colorMenu;
public GameObject shapesMenu;
public GameObject lightingMenu;
public GameObject expMenu;
public GameObject RotMenu; private bool ActiveMenu = false;
public GameObject ColorMenu;
public GameObject ShapesMenu;
public GameObject LightingMenu;
public GameObject ExpMenu;
public GameObject Square; //Shapes - Prefabs
public GameObject player;
public GameObject Cube;
public GameObject Sphere; public GameObject Sphere;
public GameObject Cylinder; public GameObject Cylinder;
public GameObject Capsule; public GameObject Capsule;
public GameObject Temp; public GameObject Temp;
public GameObject mySpawn; public GameObject mySpawn;
//Use with lighting menu
//private GameObject lighting = GameObject.FindGameObjectWithTag("Lighting");
public float lightRotX, lightRotY, lightRotZ;
private string Spawn = "Spawn"; private string Spawn = "Spawn";
private string Active = "Cube"; private string Active = "Cube";
private bool ActiveMenu = false;
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
Temp = Square; player = GameObject.FindGameObjectWithTag("Player");
mySpawn = GameObject.Find("PlayerSpawn");
InitializeButtonArrays();
Temp = Cube;
lightRotX = 0;
lightRotY = 0;
lightRotZ = 0;
//EditLightingRotation();
//EditLightingLocation();
}
public void Update()
{
GameObject.FindGameObjectWithTag("Lighting").transform.Rotate(lightRotX, lightRotY, lightRotZ);
} }
public void ToggleRotationMenu() public void ToggleRotationMenu()
{ {
if (RotMenu.gameObject.active) if (rotMenu.gameObject.activeSelf)
{ {
RotMenu.gameObject.SetActive(false); rotMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
else if (!RotMenu.gameObject.active && ActiveMenu) else if (!rotMenu.gameObject.activeSelf && ActiveMenu)
{ {
CloseAll(); CloseAll();
RotMenu.gameObject.SetActive(true); rotMenu.gameObject.SetActive(true);
} }
else else
{ {
RotMenu.gameObject.SetActive(true); rotMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
} }
public void ToggleColorMenu() public void ToggleColorMenu()
{ {
if (ColorMenu.gameObject.active) if (colorMenu.activeSelf)
{ {
ColorMenu.gameObject.SetActive(false); colorMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
else if (!ColorMenu.gameObject.active && ActiveMenu) else if (!colorMenu.activeSelf && ActiveMenu)
{ {
CloseAll(); CloseAll();
ColorMenu.gameObject.SetActive(true); colorMenu.SetActive(true);
} }
else else
{ {
ColorMenu.gameObject.SetActive(true); colorMenu.SetActive(true);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
} }
public void ToggleShapesMenu() public void ToggleShapesMenu()
{ {
if (ShapesMenu.gameObject.active) if (shapesMenu.gameObject.activeSelf)
{ {
ShapesMenu.gameObject.SetActive(false); shapesMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
else if (!ShapesMenu.gameObject.active && ActiveMenu) else if (!shapesMenu.gameObject.activeSelf && ActiveMenu)
{ {
CloseAll(); CloseAll();
ShapesMenu.gameObject.SetActive(true); shapesMenu.gameObject.SetActive(true);
} }
else else
{ {
ShapesMenu.gameObject.SetActive(true); shapesMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
@ -89,87 +115,343 @@ public class ToggleMenus : MonoBehaviour
public void ToggleLightingMenu() public void ToggleLightingMenu()
{ {
if (LightingMenu.gameObject.active) if (lightingMenu.gameObject.activeSelf)
{ {
LightingMenu.gameObject.SetActive(false); lightingMenu.gameObject.SetActive(false);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
else if (!LightingMenu.gameObject.active && ActiveMenu) else if (!lightingMenu.gameObject.activeSelf && ActiveMenu)
{ {
CloseAll(); CloseAll();
LightingMenu.gameObject.SetActive(true); lightingMenu.gameObject.SetActive(true);
} }
else else
{ {
LightingMenu.gameObject.SetActive(true); lightingMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
} }
public void ToggleExpMenu() public void ToggleExpMenu()
{ {
if (ExpMenu.gameObject.active) if (expMenu.gameObject.activeSelf)
{ {
ExpMenu.gameObject.SetActive(false); expMenu.gameObject.SetActive(false);
//check if another menu is open to avoid overlapping //check if another menu is open to avoid overlapping
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
else if (!ExpMenu.gameObject.active && ActiveMenu) else if (!expMenu.gameObject.activeSelf && ActiveMenu)
{ {
CloseAll(); CloseAll();
ExpMenu.gameObject.SetActive(true); expMenu.gameObject.SetActive(true);
} }
else else
{ {
ExpMenu.gameObject.SetActive(true); expMenu.gameObject.SetActive(true);
ActiveMenu = !ActiveMenu; ActiveMenu = !ActiveMenu;
} }
} }
public void CloseAll() public void CloseAll()
{ {
ShapesMenu.gameObject.SetActive(false); shapesMenu.gameObject.SetActive(false);
RotMenu.gameObject.SetActive(false); rotMenu.gameObject.SetActive(false);
ColorMenu.gameObject.SetActive(false); colorMenu.gameObject.SetActive(false);
LightingMenu.gameObject.SetActive(false); lightingMenu.gameObject.SetActive(false);
ExpMenu.gameObject.SetActive(false); expMenu.gameObject.SetActive(false);
} }
public void ChangeShapeSquare() public void ChangeShape(string shape)
{ {
Instantiate(Square, mySpawn.transform.position, mySpawn.transform.rotation); switch (shape)
Debug.Log("Destroy " + Active); {
Destroy(GameObject.Find(Active)); case "Cube":
Active = "Cube(Clone)"; Instantiate(Cube, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log(Active); Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Cube(Clone)";
player = GameObject.FindGameObjectWithTag("Player");
Debug.Log(Active);
break;
case "Sphere":
Instantiate(Sphere, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Sphere(Clone)";
player = GameObject.FindGameObjectWithTag("Player");
Debug.Log(Active);
break;
case "Capsule":
Instantiate(Capsule, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Capsule(Clone)";
player = GameObject.FindGameObjectWithTag("Player");
Debug.Log(Active);
break;
case "Cylinder":
Instantiate(Cylinder, mySpawn.transform.position, mySpawn.transform.rotation);
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Cylinder(Clone)";
player = GameObject.FindGameObjectWithTag("Player");
Debug.Log(Active);
break;
default:
Debug.Log("Error - Not a valid shape : " + shape);
break;
}
} }
public void ChangeShapeSphere() /*
public void EditLightingRotation()
{ {
Instantiate(Sphere, mySpawn.transform.position, mySpawn.transform.rotation); buttons = GameObject.FindGameObjectsWithTag("RotationMenuButtons");
Debug.Log("Destroy " + Active); foreach (Object button in buttons)
Destroy(GameObject.Find(Active)); {
Active = "Sphere(Clone)"; gameObject.GetComponent<Button>().onClick.RemoveAllListeners();
Debug.Log(Active); }
/*
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 ChangeShapeCapsule() public void EditLightingLocation()
{ {
Instantiate(Capsule, mySpawn.transform.position, mySpawn.transform.rotation); buttons = GameObject.FindGameObjectsWithTag("RotationMenuButtons");
Debug.Log("Destroy " + Active); foreach (Object button in buttons)
Destroy(GameObject.Find(Active)); {
Active = "Capsule(Clone)"; gameObject.GetComponent<Button>().onClick.RemoveAllListeners();
Debug.Log(Active); }
//
//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 ChangeShapeCylinder() public void EditLightingLocationX()
{ {
Instantiate(Cylinder, mySpawn.transform.position, mySpawn.transform.rotation); //lightRotX = 20 * Time.deltaTime;
Debug.Log("Destroy " + Active);
Destroy(GameObject.Find(Active));
Active = "Cylinder(Clone)";
Debug.Log(Active);
} }
public void EditLightingRotationX()
{
lightRotX = 20 * Time.deltaTime;
}
public void EditLightingRotationY()
{
lightRotY = 20 * Time.deltaTime;
}
public void EditLightingRotationZ()
{
lightRotZ = 20 * Time.deltaTime;
}
*/
public void InitializeButtonArrays()
{
List<Button> mainButtons = new List<Button>();
List<Button> rotationButtons = new List<Button>();
List<Button> colorButtons = new List<Button>();
List<Button> shapesButtons = new List<Button>();
List<Button> lightingButtons = new List<Button>();
List<Button> expButtons = new List<Button>();
//Component spinningCube = player.GetComponent<SpinningCube>();
Button[] allButtons = GameObject.Find("UI Canvas").GetComponentsInChildren<Button>(true);
foreach(Button b in allButtons)
{
if (b.gameObject.transform.parent.name.Contains("Main"))
{
mainButtons.Add(b.gameObject.GetComponent<Button>());
}
if (b.gameObject.transform.parent.name.Contains("Rotation"))
{
rotationButtons.Add(b.gameObject.GetComponent<Button>());
}
if (b.gameObject.transform.parent.name.Contains("Color"))
{
colorButtons.Add(b.gameObject.GetComponent<Button>());
}
if (b.gameObject.transform.parent.name.Contains("Shapes"))
{
shapesButtons.Add(b.gameObject.GetComponent<Button>());
}
if (b.gameObject.transform.parent.name.Contains("Lighting"))
{
lightingButtons.Add(b.gameObject.GetComponent<Button>());
}
if (b.gameObject.transform.parent.name.Contains("Exp"))
{
expButtons.Add(b.gameObject.GetComponent<Button>());
}
}
//5 (0-4)
Debug.Log("mainButtons: " + mainButtons.Count);
//5 (0-4)
Debug.Log("rotationButtons: " + rotationButtons.Count);
//8 (0-7)
Debug.Log("colorButtons: " + colorButtons.Count);
//4 (0-3)
Debug.Log("shapesButtons: " + shapesButtons.Count);
//3 (0-2)
Debug.Log("lightingButtons: " + lightingButtons.Count);
//3 (0-2)
Debug.Log("expButtons: " + expButtons.Count);
mainButtons[0].onClick.AddListener(() => { ToggleRotationMenu(); });
mainButtons[1].onClick.AddListener(() => { ToggleColorMenu(); });
mainButtons[2].onClick.AddListener(() => { ToggleShapesMenu(); });
mainButtons[3].onClick.AddListener(() => { ToggleLightingMenu(); });
mainButtons[4].onClick.AddListener(() => { ToggleExpMenu(); });
rotationButtons[0].onClick.AddListener(() => { RaiseRotationSpeed(); });
rotationButtons[1].onClick.AddListener(() => { LowerRotationSpeed(); });
rotationButtons[2].onClick.AddListener(() => { ToggleRotation(); });
rotationButtons[3].onClick.AddListener(() => { ToggleRotationDirection(); });
rotationButtons[4].onClick.AddListener(() => { ResetRotationSpeed(); });
colorButtons[0].onClick.AddListener(() => { ChangeColor("Black"); });
colorButtons[1].onClick.AddListener(() => { ChangeColor("White"); });
colorButtons[2].onClick.AddListener(() => { ChangeColor("Red"); });
colorButtons[3].onClick.AddListener(() => { ChangeColor("Green"); });
colorButtons[4].onClick.AddListener(() => { ChangeColor("Blue"); });
colorButtons[5].onClick.AddListener(() => { ChangeColor("Yellow"); });
colorButtons[6].onClick.AddListener(() => { ChangeColor("Cyan"); });
colorButtons[7].onClick.AddListener(() => { ChangeColor("Magenta"); });
shapesButtons[0].onClick.AddListener(() => { ChangeShape("Cylinder"); });
shapesButtons[1].onClick.AddListener(() => { ChangeShape("Capsule"); });
shapesButtons[2].onClick.AddListener(() => { ChangeShape("Cube"); });
shapesButtons[3].onClick.AddListener(() => { ChangeShape("Sphere"); });
//Temporary save/load hidden in lighting for debug
lightingButtons[0].onClick.AddListener(() => { GameObject.Find("EventSystem").GetComponent<GameManager>().Save(); });
lightingButtons[1].onClick.AddListener(() => { GameObject.Find("EventSystem").GetComponent<GameManager>().Load(); });
//lightingButtons[2].onClick.AddListener(() => { function(); });
expButtons[0].onClick.AddListener(() => { GameObject.Find("Gained Image").GetComponent<ExperienceBar>().ExpMore(); });
expButtons[1].onClick.AddListener(() => { GameObject.Find("Gained Image").GetComponent<ExperienceBar>().ExpLess(); });
expButtons[2].onClick.AddListener(() => { GameObject.Find("Gained Image").GetComponent<ExperienceBar>().ResetExp(); });
}
public void ToggleRotationDirection()
{
if (GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection == Vector3.up)
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection = Vector3.down;
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().RotationDirection = "Down";
}
else
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection = Vector3.up;
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().RotationDirection = "Up";
}
Debug.Log("Toggled rotation direction: " + GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().RotationDirection);
}
public void ToggleRotation()
{
Debug.Log("Stopping Rotation. Last known rotation direction: " + GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().RotationDirection);
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().stopRotation = Vector3.zero;
if (GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection == GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().stopRotation)
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().tempRotation;
}
else
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().tempRotation = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection;
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().m_RotationDirection = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().stopRotation;
}
}
public void RaiseRotationSpeed()
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed + GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentIncrement;
Debug.Log("Rotation Speed: " + GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed);
}
public void LowerRotationSpeed()
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed = GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed - GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentIncrement;
Debug.Log("Rotation Speed: " + GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed);
}
public void ResetRotationSpeed()
{
GameObject.FindGameObjectWithTag("Player").GetComponent<SpinningCube>().currentSpeed = 20.0f;
Debug.Log("Rotation Speed Reset");
}
public void ChangeColor(string color)
{
switch (color)
{
case "White":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.white;
break;
case "Blue":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.blue;
break;
case "Black":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.black;
break;
case "Green":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.green;
break;
case "Red":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.red;
break;
case "Magenta":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.magenta;
break;
case "Yellow":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.yellow;
break;
case "Cyan":
GameObject.FindGameObjectWithTag("Player").GetComponent<Renderer>().material.color = Color.cyan;
break;
default:
Debug.Log("Error - no color named :" + color);
break;
}
}
} }

45
Logs/Packages-Update.log Normal file
View File

@ -0,0 +1,45 @@
=== Mon Nov 23 15:21:06 2020
Packages were changed.
Update Mode: resetToDefaultDependencies
The following packages were added:
com.unity.collab-proxy@1.2.16
com.unity.ide.rider@1.1.4
com.unity.ide.vscode@1.2.0
com.unity.modules.ai@1.0.0
com.unity.modules.androidjni@1.0.0
com.unity.modules.animation@1.0.0
com.unity.modules.assetbundle@1.0.0
com.unity.modules.audio@1.0.0
com.unity.modules.cloth@1.0.0
com.unity.modules.director@1.0.0
com.unity.modules.imageconversion@1.0.0
com.unity.modules.imgui@1.0.0
com.unity.modules.jsonserialize@1.0.0
com.unity.modules.particlesystem@1.0.0
com.unity.modules.physics@1.0.0
com.unity.modules.physics2d@1.0.0
com.unity.modules.screencapture@1.0.0
com.unity.modules.terrain@1.0.0
com.unity.modules.terrainphysics@1.0.0
com.unity.modules.tilemap@1.0.0
com.unity.modules.ui@1.0.0
com.unity.modules.uielements@1.0.0
com.unity.modules.umbra@1.0.0
com.unity.modules.unityanalytics@1.0.0
com.unity.modules.unitywebrequest@1.0.0
com.unity.modules.unitywebrequestassetbundle@1.0.0
com.unity.modules.unitywebrequestaudio@1.0.0
com.unity.modules.unitywebrequesttexture@1.0.0
com.unity.modules.unitywebrequestwww@1.0.0
com.unity.modules.vehicles@1.0.0
com.unity.modules.video@1.0.0
com.unity.modules.vr@1.0.0
com.unity.modules.wind@1.0.0
com.unity.modules.xr@1.0.0
com.unity.test-framework@1.1.13
com.unity.textmeshpro@2.0.1
com.unity.timeline@1.2.14
com.unity.ugui@1.0.0

42
Packages/manifest.json Normal file
View File

@ -0,0 +1,42 @@
{
"dependencies": {
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.0",
"com.unity.test-framework": "1.1.13",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.14",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1 +1,2 @@
m_EditorVersion: 2017.1.0f3 m_EditorVersion: 2019.3.13f1
m_EditorVersionWithRevision: 2019.3.13f1 (d4ddf0d95db9)

Binary file not shown.

View File

@ -0,0 +1,10 @@
{
"m_SettingKeys": [
"VR Device Disabled",
"VR Device User Alert"
],
"m_SettingValues": [
"False",
"False"
]
}

View File

@ -1,2 +1,21 @@
# SpinningCube # SpinningCube
First Android Unity project First Android Unity project
A basic Android Application that can be built and played either on a device as a .apk or within the unity editor.
Not a game, but a demonstration of C# scripting within unity to create an idle-clicker like EXP system.
A learning experience.
The cube spins on the screen at a slow rate initially, as the cube rotates every full rotation grants exp.
Upon leveling up the rotation speed is increased.
Saves player data on exit, loads on start.
If the app is closed, or otherwise suspended, when returning EXP is added for time spent away and awarded to player.
Feel free to use the UI buttons to force your speed to ridiculous amounts.
Other fun debugging options in there, as well as changing the color of the cube.
Have fun, feel free to make a pull request.
![Screenshot of spinningcube](Screenshot.PNG)

BIN
Screenshot.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB