Commit 4a1d620a authored by astatham's avatar astatham
Browse files

Added power bar, pie is thrown after first angle, then power is set (space for...

Added power bar, pie is thrown after first angle, then power is set (space for angle, left shift for power because pie throws as soon as angle set if both space)
Note: buggy
parent f0adc3a6
......@@ -242,6 +242,81 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &992615372
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 992615374}
- component: {fileID: 992615373}
m_Layer: 0
m_Name: rope 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &992615373
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 992615372}
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: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: abc7c8627cab5494da8e4bd5f24a5796, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5, y: 0.86}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &992615374
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 992615372}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -5.451332, y: -3.917585, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1048895977
GameObject:
m_ObjectHideFlags: 0
......@@ -273,7 +348,6 @@ MonoBehaviour:
angleChangeSpeed: 10
maxAngle: 45
minAngle: 0
piePrefab: {fileID: 4682816416884212, guid: 39accd453c2c645ab81f09dc448b32c6, type: 2}
--- !u!212 &1048895979
SpriteRenderer:
m_ObjectHideFlags: 0
......@@ -333,6 +407,97 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1375899855
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1375899858}
- component: {fileID: 1375899857}
- component: {fileID: 1375899856}
m_Layer: 0
m_Name: arrow
m_TagString: PowerBar
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1375899856
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1375899855}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be66c6df149ac493e9687be3324e4f01, type: 3}
m_Name:
m_EditorClassIdentifier:
posChangeSpeed: 10
maxPos: -3
minPos: -8
piePrefab: {fileID: 4682816416884212, guid: 39accd453c2c645ab81f09dc448b32c6, type: 2}
--- !u!212 &1375899857
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1375899855}
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: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 9731ee7c67f86481aab7cece5317c667, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5.12, y: 5.12}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1375899858
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1375899855}
m_LocalRotation: {x: 0, y: 0, z: 1, w: 0}
m_LocalPosition: {x: -8, y: -3, z: 0}
m_LocalScale: {x: 0.21, y: 0.17, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180}
--- !u!1 &1666194995
GameObject:
m_ObjectHideFlags: 0
......@@ -479,7 +644,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1911354532}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -8.64, y: -0.16, z: 0}
m_LocalPosition: {x: -8.64, y: -0.16, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......
......@@ -4,7 +4,6 @@ using UnityEngine;
public class Needle : MonoBehaviour {
public float angleChangeSpeed, maxAngle, minAngle;
public Transform piePrefab;
float currentAngle = 0;
float previousAngle = -1f;
public static float finalAngle;
......@@ -38,7 +37,7 @@ public class Needle : MonoBehaviour {
if (Input.GetButton("Jump")){
finalAngle = currentAngle;
previousAngle = currentAngle;
Instantiate(piePrefab);
PowerBar.previousPos = -9f;
}
}
}
......@@ -24,6 +24,6 @@ public class Pie : MonoBehaviour {
void Launch(){
Vector3 direction = Quaternion.AngleAxis(Needle.finalAngle, Vector3.forward) * Vector3.right;
gameObject.GetComponent<Rigidbody2D>().AddForce(direction * 1000);
gameObject.GetComponent<Rigidbody2D>().AddForce(direction * -PowerBar.finalPos*300);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PowerBar : MonoBehaviour {
public float posChangeSpeed, maxPos, minPos;
public Transform piePrefab;
float currentPos = -8f;
public static float previousPos = -8f;
public static float finalPos;
void Update()
{
if (currentPos >= minPos && currentPos < maxPos && currentPos > previousPos)
{
gameObject.transform.position = new Vector3(currentPos, -3, 0);
previousPos = currentPos;
currentPos += (posChangeSpeed * Time.deltaTime);
}
else if (currentPos <= maxPos && currentPos > minPos && currentPos < previousPos)
{
gameObject.transform.position = new Vector3(currentPos, -3, 0);
previousPos = currentPos;
currentPos -= (posChangeSpeed * Time.deltaTime);
}
else if (currentPos > previousPos)
{
gameObject.transform.position = new Vector3(currentPos, -3, 0);
previousPos = currentPos;
currentPos -= (posChangeSpeed * Time.deltaTime);
}
else if (currentPos < previousPos)
{
gameObject.transform.position = new Vector3(currentPos, -3, 0);
previousPos = currentPos;
currentPos += (posChangeSpeed * Time.deltaTime);
}
if (Input.GetKey("left shift"))
{
finalPos = currentPos;
previousPos = currentPos;
Instantiate(piePrefab);
}
}
}
fileFormatVersion: 2
guid: be66c6df149ac493e9687be3324e4f01
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,6 +6,7 @@ TagManager:
tags:
- Perfect
- Pie
- PowerBar
layers:
- Default
- TransparentFX
......
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