Spawn distance indicator on attack, destroy after 0.5s

This commit is contained in:
2024-10-22 13:09:57 -07:00
parent 175dbbe7c5
commit 40801e4df5
5 changed files with 119 additions and 111 deletions

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using System.Collections;
public class DistanceIndicator : MonoBehaviour
{
@@ -8,12 +9,12 @@ public class DistanceIndicator : MonoBehaviour
void Start()
{
player= GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
transform.localScale = new Vector3 (player.swingDistance*multiplier, player.swingDistance*multiplier, 1);
StartCoroutine("KillMyself");
}
// Update is called once per frame
void Update()
{
Debug.Log(player.swingDistance);
transform.localScale = new Vector3 (player.swingDistance*multiplier, player.swingDistance*multiplier, 1);
}
IEnumerator KillMyself () {
yield return new WaitForSeconds (0.5F);
Destroy(gameObject);
}
}