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

@@ -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);
}
}