Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEngine.UI;
- public class HudEnemy : MonoBehaviour {
- public Image imagem;
- private Player player;
- public GameObject[] enemies;
- // Use this for initialization
- void Start () {
- imagem = gameObject.GetComponent<Image> ();
- enemies = GameObject.FindGameObjectsWithTag("Inimigo");
- player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
- }
- // Update is called once per frame
- void Update () {
- if (player.atacando) {
- for (int i = 0; i < enemies.Length; i++)
- {
- if (enemies[i].GetComponent<Inimigo>())
- {
- if(Vector3.Distance(enemies[i].transform.position, player.transform.position) <3){
- imagem.fillAmount = enemies[i].GetComponent<Inimigo>().mana;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement