Commit 9160c2cb authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

re-did the power/angle bars so that the pause menu now works

parent 636d9743
......@@ -36,8 +36,8 @@ Transform:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1202179348292156}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -8, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -8.71, y: -3.65, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -89,6 +89,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: eb3befb4f15a547e8bff90fa39004e23, type: 3}
m_Name:
m_EditorClassIdentifier:
force: 0
minForce: 4
maxForce: 8
--- !u!212 &212945997560978764
SpriteRenderer:
m_ObjectHideFlags: 1
......
......@@ -213,6 +213,75 @@ Transform:
m_Father: {fileID: 1046844653}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &100312131
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 100312134}
- component: {fileID: 100312133}
- component: {fileID: 100312132}
m_Layer: 5
m_Name: AngleMeter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &100312132
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 100312131}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 8d118d5fc4c16234699c946d58c7a530, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 2
m_FillAmount: 1
m_FillClockwise: 0
m_FillOrigin: 0
--- !u!222 &100312133
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 100312131}
m_CullTransparentMesh: 0
--- !u!224 &100312134
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 100312131}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1407271059}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -326, y: -122}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &198828738
GameObject:
m_ObjectHideFlags: 0
......@@ -722,81 +791,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &537888089
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 537888091}
- component: {fileID: 537888090}
m_Layer: 0
m_Name: angleMeter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &537888090
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 537888089}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -1106870113
m_SortingLayer: 1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 8d118d5fc4c16234699c946d58c7a530, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.84, y: 0.5}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &537888091
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 537888089}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -7.52, y: -2.45, z: -0.024424091}
m_LocalScale: {x: 3, y: 3, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &634434896
GameObject:
m_ObjectHideFlags: 0
......@@ -1437,7 +1431,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!212 &992615373
SpriteRenderer:
m_ObjectHideFlags: 0
......@@ -1549,7 +1543,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &1048895978
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -1620,6 +1614,68 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1132951573
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1132951576}
- component: {fileID: 1132951575}
- component: {fileID: 1132951574}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1132951574
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1132951573}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1132951575
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1132951573}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1132951576
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1132951573}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
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}
--- !u!1 &1178228077
GameObject:
m_ObjectHideFlags: 0
......@@ -1938,7 +1994,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &1375899856
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -2076,6 +2132,118 @@ Transform:
m_Father: {fileID: 484526474}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1407271054
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1407271059}
- component: {fileID: 1407271058}
- component: {fileID: 1407271057}
- component: {fileID: 1407271056}
- component: {fileID: 1407271055}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1407271055
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1407271054}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62dcd6197646ba745a427bef4fee2474, type: 3}
m_Name:
m_EditorClassIdentifier:
fillSpeed: 1
fillSmoothness: 0.01
powerBar: {fileID: 2133793784}
angleMeter: {fileID: 100312132}
piePrefab: {fileID: 1202179348292156, guid: 39accd453c2c645ab81f09dc448b32c6, type: 2}
--- !u!114 &1407271056
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1407271054}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1407271057
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1407271054}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &1407271058
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1407271054}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 1666194997}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1407271059
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1407271054}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 2133793786}
- {fileID: 100312134}
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1469565712
GameObject:
m_ObjectHideFlags: 0
......@@ -3290,3 +3458,72 @@ Transform:
m_CorrespondingSourceObject: {fileID: 4746125468523812, guid: a4fd084d2373173479c0c947fd66e9ca,
type: 2}
m_PrefabInternal: {fileID: 425617383}
--- !u!1 &2133793783
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2133793786}
- component: {fileID: 2133793785}
- component: {fileID: 2133793784}
m_Layer: 5
m_Name: PowerBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2133793784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2133793783}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: e986269e371ef3048b13fd122c2f8ff4, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2133793785
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2133793783}
m_CullTransparentMesh: 0
--- !u!224 &2133793786
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2133793783}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2, y: 0.4, z: 1}
m_Children: []
m_Father: {fileID: 1407271059}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -372, y: 104}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
fileFormatVersion: 2
guid: e2e8c3bab127348c5ab845ce853f4caf
guid: 1301b50af2797864398df1640fd2e3aa
DefaultImporter:
externalObjects: {}
userData:
......
......@@ -14,13 +14,13 @@ public class Needle : MonoBehaviour {
{
if (PieManager.pieCount > 0)
{
if (Input.GetKeyDown("space"))
if (Input.GetKeyDown(KeyCode.Space))
{
finalAngle = currentAngle;
angleChangeSpeed = 0;
PowerBar.previousPos = -9f;
}
else if (!Input.GetKey("space"))
else if (!Input.GetKey(KeyCode.Space))
{
MoveNeedle();
}
......
......@@ -3,10 +3,14 @@ using System.Collections.Generic;
using UnityEngine;
public class Pie : MonoBehaviour {
[HideInInspector]
public float force;// an number from zero to one determining the force on the pie
public float minForce = 4f;
public float maxForce = 8f;
// Use this for initialization
void Start () {
// Use this for initialization
void Start () {
Launch();
}
......@@ -31,7 +35,9 @@ public class Pie : MonoBehaviour {
}
void Launch(){
Vector3 direction = Quaternion.AngleAxis(Needle.finalAngle, Vector3.forward) * Vector3.right;
gameObject.GetComponent<Rigidbody2D>().AddForce(direction * (4 + (PowerBar.finalPos+2))*100);
//Vector3 direction = Quaternion.AngleAxis(Needle.finalAngle, Vector3.forward) * Vector3.right;
float forceAmmount = (force * (maxForce - minForce)) + minForce;
//print(forceAmmount);
gameObject.GetComponent<Rigidbody2D>().AddForce(transform.up * forceAmmount * 100);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class throwManager : MonoBehaviour {
public float fillSpeed = 1f;
public float fillSmoothness = 0.01f;
public Image powerBar;
public Image angleMeter;
public GameObject piePrefab;
private float timeCount;
private bool PowerIncreasing;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyUp("space") && PieManager.pieCount > 0) {
//create pie object and set its power to the powerBars fill
GameObject pie = Instantiate(piePrefab, piePrefab.transform.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90 )));
pie.GetComponent<Pie>().force = powerBar.fillAmount;
PieManager.pieInScene = true;
PieManager.pieCount--;
}
if (PieManager.pieCount > 0) {
if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar);
PowerIncreasing = true;//always increase power after angle is chosen
} else {
fillSomething(angleMeter);
}
}
}
void fillSomething(Image thing) {
if (Time.time > timeCount) {
timeCount = Time.time + fillSmoothness;//do stuff every 0.1 second
//if fill reaches top or bottom, change direction
if (thing.fillAmount >= 1f || thing.fillAmount <= 0f) {
PowerIncreasing = !PowerIncreasing;
}
//increase or decrease fill ammount based on direction
if (PowerIncreasing) {
thing.fillAmount += fillSpeed * fillSmoothness;
} else {
thing.fillAmount -= fillSpeed * fillSmoothness;
}
}
}
}
fileFormatVersion: 2
guid: 62dcd6197646ba745a427bef4fee2474
MonoImporter:
externalObjects: {}