Distance indicator size proportional to swingDistance (still not correct)

This commit is contained in:
2024-10-22 01:47:16 -07:00
parent 23bab7a3e1
commit 374355c291
5 changed files with 112 additions and 102 deletions

View File

@@ -319,6 +319,10 @@ PrefabInstance:
propertyPath: dashDistance
value: 1000
objectReference: {fileID: 0}
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
propertyPath: distanceIndicator
value:
objectReference: {fileID: 6743253301251978515, guid: c4d4b8228002b32e89ba2545d2ace771, type: 3}
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
propertyPath: attackCooldownSeconds
value: 3
@@ -334,6 +338,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 4154134366646162009, guid: e05928a0d673caf999d31b31b994a112, type: 3}
insertIndex: -1
addedObject: {fileID: 1873397571}
- targetCorrespondingSourceObject: {fileID: 4154134366646162009, guid: e05928a0d673caf999d31b31b994a112, type: 3}
insertIndex: -1
addedObject: {fileID: 1891545562}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 3739677681433878215, guid: e05928a0d673caf999d31b31b994a112, type: 3}
insertIndex: -1
@@ -1079,6 +1086,106 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1891545561
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1891545562}
- component: {fileID: 1891545564}
- component: {fileID: 1891545563}
m_Layer: 0
m_Name: Circle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1891545562
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1891545561}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1246075822}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1891545563
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1891545561}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23dc3f32eba4c9e5aad24589fdbfa30c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &1891545564
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1891545561}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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: -3951105813050061920, guid: 46817c0fa76c6a671b18883470b5daed, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0

View File

@@ -14,6 +14,7 @@ public class Teo : MonoBehaviour
public float dashCooldownSeconds = 5;
public float lastAttackTime = 0;
public float lastDashTime = 0;
public GameObject distanceIndicator;
Rigidbody2D controller;
GameState gameState;
bool dashing;

View File

@@ -2,18 +2,17 @@ using UnityEngine;
public class DistanceIndicator : MonoBehaviour
{
Teo player;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
Teo player = GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
RectTransform rect = GetComponent<RectTransform>();
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, player.swingDistance*2);
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, player.swingDistance*2);
player= GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
}
// Update is called once per frame
void Update()
{
Debug.Log(player.swingDistance);
transform.localScale = new Vector3 (player.swingDistance*0.2F, player.swingDistance*0.2F, 1);
}
}

View File

@@ -1,90 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6743253301251978515
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7438228175666914604}
- component: {fileID: 3732086603579851193}
- component: {fileID: 4460286574818953559}
- component: {fileID: 8349812527292480333}
m_Layer: 5
m_Name: DistanceIndicator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7438228175666914604
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6743253301251978515}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
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: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3732086603579851193
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6743253301251978515}
m_CullTransparentMesh: 1
--- !u!114 &4460286574818953559
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6743253301251978515}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -3951105813050061920, guid: 46817c0fa76c6a671b18883470b5daed, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8349812527292480333
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6743253301251978515}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23dc3f32eba4c9e5aad24589fdbfa30c, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: c4d4b8228002b32e89ba2545d2ace771
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: