Distance indicator prefab and script

White circle with radius player.swingDistance
This commit is contained in:
2024-10-22 01:15:40 -07:00
parent c196ad0e3a
commit 23bab7a3e1
5 changed files with 118 additions and 76 deletions

View File

@@ -0,0 +1,19 @@
using UnityEngine;
public class DistanceIndicator : MonoBehaviour
{
// 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);
}
// Update is called once per frame
void Update()
{
}
}