i have a gameobject which has animation attached to. at the last frame of that animation , there is an event which runs a function from one script. but i need as soon as this function runs , if player click on that gameobject in the scene , then a radial health bar appears there at the place of that gameobject.
i have already created the radial health bar , but with code i have not any idea how to begin it. any help?
here is code to this gameobject i have already .
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BucketAnimation : MonoBehaviour
{
Animator anim;
public GameObject wateronfloor;
private float MaxTime = 5f;
public GameObject TimerParent;
public Image Timerbar;
float TimeLeft;
bool move = false;
void Start ()
{
anim = wateronfloor.GetComponent <Animator> ();
TimeLeft = MaxTime;
TimerParent.SetActive (false);
}
void Update()
{
if (move)
{
if (TimeLeft > 0)
{
TimeLeft -= Time.deltaTime;
Timerbar.fillAmount = TimeLeft / MaxTime;
}
else
{
}
}
}
public void WaterOnFloor()
{
anim.Play ("animationWater");
}
void TimerBar()
{
move = true;
TimerParent.SetActive (true);
TimerParent.transform.position = new Vector3(wateronfloor.GetComponent <Animator> ().transform.position.x ,
wateronfloor.GetComponent <Animator> ().transform.position.y + 0.5f,
wateronfloor.GetComponent <Animator> ().transform.position.z);
}
public void clickedonDamage()
{
}
}