Distance indicator fades out instead of disappearing
This commit is contained in:
@@ -5,15 +5,21 @@ public class DistanceIndicator : MonoBehaviour
|
||||
{
|
||||
public float multiplier;
|
||||
Teo player;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
player= GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
|
||||
SpriteRenderer sprite;
|
||||
float timeCreated;
|
||||
void Start() {
|
||||
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Teo>();
|
||||
sprite = GetComponent<SpriteRenderer>();
|
||||
timeCreated = Time.fixedTime;
|
||||
transform.localScale = new Vector3 (player.swingDistance*multiplier, player.swingDistance*multiplier, 1);
|
||||
StartCoroutine("KillMyself");
|
||||
}
|
||||
|
||||
IEnumerator KillMyself () {
|
||||
void Update() {
|
||||
sprite.color = new Color (1F, 1F, 1F, 0.5F-(Time.fixedTime-timeCreated));
|
||||
}
|
||||
|
||||
IEnumerator KillMyself() {
|
||||
yield return new WaitForSeconds (0.5F);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user