Hurt thingy
This commit is contained in:
@@ -1516,6 +1516,7 @@ RectTransform:
|
|||||||
- {fileID: 3829510704376804164}
|
- {fileID: 3829510704376804164}
|
||||||
- {fileID: 1905263355016614080}
|
- {fileID: 1905263355016614080}
|
||||||
- {fileID: 7579812889699807472}
|
- {fileID: 7579812889699807472}
|
||||||
|
- {fileID: 1708238816229026157}
|
||||||
m_Father: {fileID: 3614641596273148411}
|
m_Father: {fileID: 3614641596273148411}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
@@ -1646,6 +1647,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: d84633c3f717e0d4f834bb2514e64c35, type: 3}
|
m_Script: {fileID: 11500000, guid: d84633c3f717e0d4f834bb2514e64c35, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
HurtOverlay: {fileID: 6456657860247816393}
|
||||||
SliderThing: {fileID: 6656112534571270696}
|
SliderThing: {fileID: 6656112534571270696}
|
||||||
--- !u!136 &2494850548308267933
|
--- !u!136 &2494850548308267933
|
||||||
CapsuleCollider:
|
CapsuleCollider:
|
||||||
@@ -2071,6 +2073,81 @@ RectTransform:
|
|||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!1 &6456657860247816393
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1708238816229026157}
|
||||||
|
- component: {fileID: 1444512173245577763}
|
||||||
|
- component: {fileID: 2347158115666318496}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: RedOverlayThing
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!224 &1708238816229026157
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6456657860247816393}
|
||||||
|
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: 834552907522022778}
|
||||||
|
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: 1920, y: 1080}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &1444512173245577763
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6456657860247816393}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &2347158115666318496
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 6456657860247816393}
|
||||||
|
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: 0.7264151, g: 0, b: 0, a: 0.8627451}
|
||||||
|
m_RaycastTarget: 0
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 0}
|
||||||
|
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!1 &6595568981009816699
|
--- !u!1 &6595568981009816699
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -6,7 +7,9 @@ namespace InterfaceOff.WorldScene
|
|||||||
{
|
{
|
||||||
public class LifeThingTrackerThing : MonoBehaviour
|
public class LifeThingTrackerThing : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[SerializeField] private GameObject HurtOverlay;
|
||||||
[SerializeField] private Slider SliderThing;
|
[SerializeField] private Slider SliderThing;
|
||||||
|
|
||||||
private Rigidbody body;
|
private Rigidbody body;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
@@ -18,11 +21,13 @@ namespace InterfaceOff.WorldScene
|
|||||||
{
|
{
|
||||||
Vector3 pos = transform.localPosition;
|
Vector3 pos = transform.localPosition;
|
||||||
pos.y = Mathf.Clamp(pos.y, 0, 10);
|
pos.y = Mathf.Clamp(pos.y, 0, 10);
|
||||||
transform.localPosition = pos;
|
|
||||||
|
|
||||||
if (pos.y == 0.0f)
|
if (Mathf.Approximately(pos.y, 0.0f))
|
||||||
{
|
{
|
||||||
|
StartCoroutine(routine: DisplayHurtOverlay());
|
||||||
|
|
||||||
body.velocity = Vector3.zero;
|
body.velocity = Vector3.zero;
|
||||||
|
pos.y = 10.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mathf.Approximately(pos.y, 10.0f))
|
if (Mathf.Approximately(pos.y, 10.0f))
|
||||||
@@ -30,6 +35,7 @@ namespace InterfaceOff.WorldScene
|
|||||||
body.velocity = Vector3.zero;
|
body.velocity = Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transform.localPosition = pos;
|
||||||
SliderThing.value = pos.y;
|
SliderThing.value = pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,5 +44,12 @@ namespace InterfaceOff.WorldScene
|
|||||||
Vector3 vel = body.velocity;
|
Vector3 vel = body.velocity;
|
||||||
body.AddForce(Vector3.up * 500f, ForceMode.Force);
|
body.AddForce(Vector3.up * 500f, ForceMode.Force);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator DisplayHurtOverlay()
|
||||||
|
{
|
||||||
|
HurtOverlay.SetActive(true);
|
||||||
|
yield return new WaitForSecondsRealtime(time: 0.1f);
|
||||||
|
HurtOverlay.SetActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user