Commit 74f5b715 authored by astatham's avatar astatham
Browse files

Angle select resumes once space is released

parent 44e618a8
......@@ -480,6 +480,60 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &626288396
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 626288398}
- component: {fileID: 626288397}
m_Layer: 0
m_Name: RightWall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &626288397
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 626288396}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.3, y: -4.53}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.36, y: 9.93}
m_EdgeRadius: 0
--- !u!4 &626288398
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 626288396}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 8.43, y: 4.54, z: -0.024424091}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &907546174
GameObject:
m_ObjectHideFlags: 0
......@@ -1014,3 +1068,57 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2076489824
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2076489826}
- component: {fileID: 2076489825}
m_Layer: 0
m_Name: Floor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!61 &2076489825
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076489824}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 8.9, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 17.92, y: 0.46}
m_EdgeRadius: 0
--- !u!4 &2076489826
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2076489824}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -8.89, y: -4.97, z: -0.024424091}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
public class Needle : MonoBehaviour {
public static float angleChangeSpeed = 50;
public static float angleChangeSpeed;
public static float maxAngle = 90f;
public static float minAngle = 0;
public static float currentAngle = 0;
......@@ -12,50 +12,47 @@ public class Needle : MonoBehaviour {
void Update()
{
if (!FindObjectOfType<Pie>())
{
if (currentAngle >= minAngle && currentAngle < maxAngle && currentAngle > previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle += (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle <= maxAngle && currentAngle > minAngle && currentAngle < previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle -= (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle > previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle -= (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle < previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle += (angleChangeSpeed * Time.deltaTime);
}
if (Input.GetKeyDown("space"))
{
finalAngle = currentAngle;
angleChangeSpeed = 0;
PowerBar.previousPos = -9f;
}
if (Input.GetKeyDown("space"))
{
finalAngle = currentAngle;
angleChangeSpeed = 0;
PowerBar.previousPos = -9f;
} else if (!Input.GetKey("space")){
MoveNeedle();
}
}
public static void ResetAngles()
public void MoveNeedle()
{
angleChangeSpeed = 50;
//currentAngle = 0;
previousAngle = -1f;
//finalAngle = -1f;
if (currentAngle >= minAngle && currentAngle < maxAngle && currentAngle > previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle += (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle <= maxAngle && currentAngle > minAngle && currentAngle < previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle -= (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle > previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle -= (angleChangeSpeed * Time.deltaTime);
}
else if (currentAngle < previousAngle)
{
gameObject.transform.rotation = Quaternion.Euler(0, 0, currentAngle);
previousAngle = currentAngle;
currentAngle += (angleChangeSpeed * Time.deltaTime);
}
}
}
......@@ -6,7 +6,7 @@ public class PowerBar : MonoBehaviour {
public float posChangeSpeed, maxPos, minPos;
public Transform piePrefab;
float currentPos = -2f;
public static float currentPos = -2f;
public static float previousPos = -2f;
public static float finalPos;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment