Distance indicator prefab and script
White circle with radius player.swingDistance
This commit is contained in:
19
Assets/UI overlay/DistanceIndicator.cs
Normal file
19
Assets/UI overlay/DistanceIndicator.cs
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user