Compare commits
3 Commits
c3a0e39c65
...
14e6c341e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 14e6c341e7 | |||
| f10d0bf7ca | |||
| 0c43fc1112 |
@@ -34,7 +34,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: -20}
|
||||||
m_SizeDelta: {x: 200, y: 200}
|
m_SizeDelta: {x: 200, y: 200}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &9139133142503423203
|
--- !u!222 &9139133142503423203
|
||||||
@@ -75,6 +75,120 @@ MonoBehaviour:
|
|||||||
m_FillOrigin: 0
|
m_FillOrigin: 0
|
||||||
m_UseSpriteMesh: 0
|
m_UseSpriteMesh: 0
|
||||||
m_PixelsPerUnitMultiplier: 1
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!1 &2265690506723964757
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2762027888324636750}
|
||||||
|
- component: {fileID: 1362071040755362419}
|
||||||
|
- component: {fileID: 2038821404454815492}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: InfoText
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &2762027888324636750
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2265690506723964757}
|
||||||
|
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: 25269235060726753}
|
||||||
|
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: -15, y: 0}
|
||||||
|
m_SizeDelta: {x: 160, y: 30}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &1362071040755362419
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2265690506723964757}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &2038821404454815492
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2265690506723964757}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0, g: 0, b: 0, 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_FontData:
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_FontSize: 20
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_BestFit: 0
|
||||||
|
m_MinSize: 0
|
||||||
|
m_MaxSize: 40
|
||||||
|
m_Alignment: 3
|
||||||
|
m_AlignByGeometry: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_HorizontalOverflow: 0
|
||||||
|
m_VerticalOverflow: 0
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Text:
|
||||||
|
--- !u!1 &2281649515289431590
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 6489330010487774388}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: CollisionRect
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &6489330010487774388
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2281649515289431590}
|
||||||
|
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: 7011418079103154681}
|
||||||
|
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: 20}
|
||||||
|
m_SizeDelta: {x: 200, y: 240}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &3890928559484794403
|
--- !u!1 &3890928559484794403
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -105,12 +219,13 @@ RectTransform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 2762027888324636750}
|
||||||
- {fileID: 2035964200443923097}
|
- {fileID: 2035964200443923097}
|
||||||
m_Father: {fileID: 7011418079103154681}
|
m_Father: {fileID: 7011418079103154681}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 120}
|
m_AnchoredPosition: {x: 0, y: 100}
|
||||||
m_SizeDelta: {x: 200, y: 40}
|
m_SizeDelta: {x: 200, y: 40}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &895478976559852706
|
--- !u!222 &895478976559852706
|
||||||
@@ -315,12 +430,13 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 25269235060726753}
|
- {fileID: 25269235060726753}
|
||||||
- {fileID: 8377239034391175029}
|
- {fileID: 8377239034391175029}
|
||||||
|
- {fileID: 6489330010487774388}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 205, y: 245}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &5345782142064721643
|
--- !u!114 &5345782142064721643
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -335,7 +451,9 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
<WindowImage>k__BackingField: {fileID: 3009414327569646558}
|
<WindowImage>k__BackingField: {fileID: 3009414327569646558}
|
||||||
<Transform>k__BackingField: {fileID: 7011418079103154681}
|
<RectTransform>k__BackingField: {fileID: 7011418079103154681}
|
||||||
|
<CloseButtonRectTransform>k__BackingField: {fileID: 2035964200443923097}
|
||||||
|
<InfoText>k__BackingField: {fileID: 2038821404454815492}
|
||||||
--- !u!114 &3265764588146964386
|
--- !u!114 &3265764588146964386
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -540,6 +540,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: e090ce5928c145c0b2e514412bc9cdb2, type: 3}
|
m_Script: {fileID: 11500000, guid: e090ce5928c145c0b2e514412bc9cdb2, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
<CanvasRect>k__BackingField: {fileID: 1539476655}
|
||||||
<GameCanvas>k__BackingField: {fileID: 1539476654}
|
<GameCanvas>k__BackingField: {fileID: 1539476654}
|
||||||
<ImagePrefab>k__BackingField: {fileID: 1810675969122322477, guid: 792c010445685104eac99ebe5c3831ce,
|
<ImagePrefab>k__BackingField: {fileID: 1810675969122322477, guid: 792c010445685104eac99ebe5c3831ce,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ namespace InterfaceOff
|
|||||||
{
|
{
|
||||||
public class CanvasManager : MonoBehaviour
|
public class CanvasManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[field: SerializeField] public RectTransform CanvasRect { get; private set; }
|
||||||
[field: SerializeField] public Canvas GameCanvas { get; private set; }
|
[field: SerializeField] public Canvas GameCanvas { get; private set; }
|
||||||
|
|
||||||
[field: SerializeField] public GameObject ImagePrefab { get; private set; }
|
[field: SerializeField] public GameObject ImagePrefab { get; private set; }
|
||||||
[field: SerializeField] public ImageRegistry Images { get; set; }
|
[field: SerializeField] public ImageRegistry Images { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace InterfaceOff
|
namespace InterfaceOff
|
||||||
@@ -7,6 +8,8 @@ namespace InterfaceOff
|
|||||||
public WindowInteractions Interactions { get; set; }
|
public WindowInteractions Interactions { get; set; }
|
||||||
public WindowComponents Components { get; set; }
|
public WindowComponents Components { get; set; }
|
||||||
|
|
||||||
|
protected Vector2 Velocity;
|
||||||
|
|
||||||
public void InstantiateWindowBase()
|
public void InstantiateWindowBase()
|
||||||
{
|
{
|
||||||
transform.position = CanvasManager.GetRandomPositionOnCanvas();
|
transform.position = CanvasManager.GetRandomPositionOnCanvas();
|
||||||
@@ -14,6 +17,42 @@ namespace InterfaceOff
|
|||||||
OnWindowInstantiation();
|
OnWindowInstantiation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void LateUpdate()
|
||||||
|
{
|
||||||
|
/* Moves the component and calculates new position and half size(s) */
|
||||||
|
Components.RectTransform.anchoredPosition += Velocity * Time.deltaTime;
|
||||||
|
Vector2 position = Components.RectTransform.anchoredPosition;
|
||||||
|
|
||||||
|
Vector2 hCanvasSize = CanvasManager.Instance.CanvasRect.sizeDelta * 0.5f;
|
||||||
|
Vector2 hSize = Components.RectTransform.sizeDelta * 0.5f;
|
||||||
|
|
||||||
|
/* Calculates outcome of a horizontal bounce (if there is one) */
|
||||||
|
if (position.x + hSize.x > hCanvasSize.x || position.x - hSize.x < -hCanvasSize.x)
|
||||||
|
{
|
||||||
|
Velocity.x *= -1f; // Inverts X velocity
|
||||||
|
position.x = Math.Clamp
|
||||||
|
(
|
||||||
|
position.x,
|
||||||
|
0 - hCanvasSize.x + hSize.x,
|
||||||
|
0 + hCanvasSize.x - hSize.x
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculates outcome of vertical bounce (if there is one) */
|
||||||
|
if (position.y + hSize.y > hCanvasSize.y || position.y - hSize.y < -hCanvasSize.y)
|
||||||
|
{
|
||||||
|
Velocity.y *= -1f; // Inverts Y velocity
|
||||||
|
position.y = Math.Clamp
|
||||||
|
(
|
||||||
|
position.y,
|
||||||
|
0 - hCanvasSize.y + hSize.y,
|
||||||
|
0 + hCanvasSize.y - hSize.y
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Components.RectTransform.anchoredPosition = position; // Updates position if it is supposed to] change
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void OnWindowInstantiation() { }
|
public virtual void OnWindowInstantiation() { }
|
||||||
public virtual void OnWindowClicked() { }
|
public virtual void OnWindowClicked() { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
using TreeEditor;
|
using UnityEngine.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
namespace InterfaceOff
|
namespace InterfaceOff
|
||||||
{
|
{
|
||||||
public class WindowComponents : MonoBehaviour
|
public class WindowComponents : MonoBehaviour
|
||||||
{
|
{
|
||||||
[field: SerializeField] public Image WindowImage { get; private set; }
|
[field: SerializeField] public Image WindowImage { get; private set; }
|
||||||
[field: SerializeField] public RectTransform Transform { get; private set; }
|
[field: SerializeField] public RectTransform RectTransform { get; private set; }
|
||||||
|
[field: SerializeField] public RectTransform CloseButtonRectTransform { get; private set; }
|
||||||
|
[field: SerializeField] public Text InfoText { get; private set; }
|
||||||
|
|
||||||
public Rect Rect => new
|
public Rect Rect => new
|
||||||
(
|
(
|
||||||
Transform.position.x - Transform.rect.width / 2,
|
RectTransform.position.x - RectTransform.rect.width / 2,
|
||||||
Transform.position.y - Transform.rect.height / 2,
|
RectTransform.position.y - RectTransform.rect.height / 2,
|
||||||
Transform.rect.width,
|
RectTransform.rect.width,
|
||||||
Transform.rect.height
|
RectTransform.rect.height
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,11 @@
|
|||||||
{
|
{
|
||||||
public class BasicWindow : WindowBase
|
public class BasicWindow : WindowBase
|
||||||
{
|
{
|
||||||
|
public override void OnWindowInstantiation()
|
||||||
|
{
|
||||||
|
Components.InfoText.text = "Close";
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnWindowClicked()
|
public override void OnWindowClicked()
|
||||||
{
|
{
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
|
|||||||
@@ -7,20 +7,24 @@ namespace InterfaceOff
|
|||||||
{
|
{
|
||||||
private static Vector3[] Positions =
|
private static Vector3[] Positions =
|
||||||
{
|
{
|
||||||
new(-45, 45f),
|
new(-45, 25f),
|
||||||
new(45f, 45f),
|
new(45f, 25f),
|
||||||
new(-45, -45),
|
new(-45, -65),
|
||||||
new(45f, -45)
|
new(45f, -65)
|
||||||
};
|
};
|
||||||
|
|
||||||
private int m_TilesRotatedCorrectly;
|
private int m_TilesRotatedCorrectly;
|
||||||
|
|
||||||
public override void OnWindowInstantiation()
|
public override void OnWindowInstantiation()
|
||||||
{
|
{
|
||||||
Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet();
|
/* Lets the player know what to do via text */
|
||||||
|
Components.InfoText.text = "Rotate";
|
||||||
|
|
||||||
|
/* Creates the images to rotate */
|
||||||
|
Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet();
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
/* Fetches/Creates needed components */
|
||||||
GameObject go = Instantiate(CanvasManager.Instance.ImagePrefab, transform);
|
GameObject go = Instantiate(CanvasManager.Instance.ImagePrefab, transform);
|
||||||
RectTransform t = go.GetComponent<RectTransform>();
|
RectTransform t = go.GetComponent<RectTransform>();
|
||||||
|
|
||||||
@@ -32,6 +36,7 @@ namespace InterfaceOff
|
|||||||
img.material = new Material(Shader.Find("UI/Default"));
|
img.material = new Material(Shader.Find("UI/Default"));
|
||||||
img.sprite = sprites[i];
|
img.sprite = sprites[i];
|
||||||
|
|
||||||
|
/* Adds a function to the buttons for them to rotate */
|
||||||
Button button = go.GetComponent<Button>();
|
Button button = go.GetComponent<Button>();
|
||||||
button.onClick.AddListener(() =>
|
button.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
@@ -54,7 +59,7 @@ namespace InterfaceOff
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
public override void OnWindowClicked()
|
||||||
{
|
{
|
||||||
if (m_TilesRotatedCorrectly == 4)
|
if (m_TilesRotatedCorrectly == 4)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,17 +4,24 @@ namespace InterfaceOff
|
|||||||
{
|
{
|
||||||
public class MovingWindow : WindowBase
|
public class MovingWindow : WindowBase
|
||||||
{
|
{
|
||||||
private int m_Health = 5;
|
private int m_Health = int.MaxValue;
|
||||||
|
|
||||||
public override void OnWindowInstantiation()
|
public override void OnWindowInstantiation()
|
||||||
{
|
{
|
||||||
Components.WindowImage.color = Color.blue;
|
/* Creates a random health value */
|
||||||
|
m_Health = Random.Range(2, 6);
|
||||||
|
Components.InfoText.text = $"{m_Health}";
|
||||||
|
|
||||||
|
float angle = Random.Range(0, Mathf.PI * 2);
|
||||||
|
Velocity = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnWindowClicked()
|
public override void OnWindowClicked()
|
||||||
{
|
{
|
||||||
/* Decreases health and destroys if at 0 */
|
/* Decreases health and destroys if at 0 */
|
||||||
m_Health--;
|
m_Health--;
|
||||||
|
Components.InfoText.text = $"{m_Health}";
|
||||||
|
|
||||||
if (m_Health <= 0)
|
if (m_Health <= 0)
|
||||||
{
|
{
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
|
|||||||
30
Assets/Scripts/Windows/TrollWindow.cs
Normal file
30
Assets/Scripts/Windows/TrollWindow.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace InterfaceOff
|
||||||
|
{
|
||||||
|
public class TrollWindow : WindowBase
|
||||||
|
{
|
||||||
|
private int m_Health = int.MaxValue;
|
||||||
|
|
||||||
|
public override void OnWindowInstantiation()
|
||||||
|
{
|
||||||
|
m_Health = Random.Range(2, 6);
|
||||||
|
Components.InfoText.text = "TROLL";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnWindowClicked()
|
||||||
|
{
|
||||||
|
/* Decreases health and destroys if at 0 */
|
||||||
|
m_Health--;
|
||||||
|
if (m_Health <= 0)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If not at zero randomly moves the close button */
|
||||||
|
float randX = Random.Range(-80, 80);
|
||||||
|
Components.CloseButtonRectTransform.anchoredPosition = new Vector2(randX, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/Windows/TrollWindow.cs.meta
Normal file
3
Assets/Scripts/Windows/TrollWindow.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bdeff80fcdb04744b0f3151d7370e6f1
|
||||||
|
timeCreated: 1768419826
|
||||||
Reference in New Issue
Block a user