private void Start() { healthAmount = new Transform[GameObject.Find("HHGP").transform.GetChild(1).childCount]; playerPos = GameObject.FindGameObjectWithTag("R_hand_container").transform; player = GameObject.FindGameObjectWithTag("PLAYER").GetComponent <MoveRotation1>(); spawn = GameObject.FindObjectOfType <Spawn>(); healthInt = player.GetComponent <MoveRotation1>().crrentHp; }
public void RestoreHealth() { if (healthInt > 6) { int curHP = healthInt; healthInt = 10; player.GetComponent <MoveRotation1>().crrentHp = healthInt; for (int i = curHP; i < healthInt; i++) { healthAmount[i].gameObject.SetActive(true); } } else { int curHP = healthInt; healthInt += 4; player.GetComponent <MoveRotation1>().crrentHp = healthInt; for (int i = curHP; i < healthInt; i++) { healthAmount[i].gameObject.SetActive(true); } } }