Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class FireBall : MonoBehaviour {
- //private bool isReloaded = true;
- public Image healthBar;
- public Image healthBar2;
- public GameObject Mummy;
- public Animator anim;
- public Animator anim2;
- public Image cell;
- public Sprite key;
- public GameObject gate;
- public GameObject[] door = new GameObject[4];
- void Start(){
- healthBar = GameObject.Find("ZbBar").GetComponent<Image>();
- healthBar2 = GameObject.Find("ZbBar2").GetComponent<Image>();
- Mummy = GameObject.Find("Mummy");
- anim = Mummy.GetComponent<Animator>();
- anim2 = GameObject.Find("Boss").GetComponent<Animator>();
- cell = GameObject.Find("Item5").GetComponent<Image>();
- gate = GameObject.Find("Gate 4");
- }
- void FixedUpdate () {
- // if(isReloaded == true){
- GetComponent<Rigidbody>().velocity = GameObject.Find("Player").transform.rotation * Vector3.forward * 5f;
- //isReloaded = false;
- //StartCoroutine("Reload");
- // }
- }
- void OnTriggerEnter(Collider other){
- if(other.gameObject.name == "Mummy"){
- Destroy(gameObject);
- healthBar.fillAmount -= 0.07f;
- if(healthBar.fillAmount <= 0){
- //Destroy(Mummy);
- //Debug.Log("DEATH");
- anim.SetBool("Die", true);
- PlayerPrefs.SetString("IsDeath", "true");
- }
- }
- if(other.gameObject.name == "Boss" && other.gameObject.name != "ww_shield"){
- Destroy(gameObject);
- healthBar2.fillAmount -= 0.03f;
- if(healthBar2.fillAmount <= 0){
- //Destroy(Mummy);
- //Debug.Log("DEATH");
- cell.sprite = key;
- Color c = cell.color;
- c.a = 255f;
- cell.color = c;
- gate.SetActive(false);
- anim2.SetBool("Die", true);
- PlayerPrefs.SetString("IsDeath2", "true");
- }
- }
- else{
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement