Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (health <= 0)
        {
            KillManagerScript.AddToList();
            stateManager.Hit();
            if (!audioSrc.isPlaying)
            {
                if (!deathAudioToggle)
                {
                    audioSrc.clip = dying;
                    audioSrc.Play();
                    deathAudioToggle = true;
                }
            }

            StarDeathScript.isDead = true;
        }

        if (health <= 0)
        {
            health = 0;
        }
        else if (health >= startingHealth)
        {
            health = startingHealth;
        }
        healthBar.value = health;
    }
Пример #2
0
    public virtual void Start()
    {
        isVibOn     = PlayerPrefs.GetInt("toggleVib", 1);
        flashSprite = GetComponentInChildren <SpriteRenderer> ();
        //originalMaterial = gameObject.GetComponentInChildren<Texture>();
        //print (originalMaterial.name);

        killManager = GameObject.Find("KillManager").GetComponent <KillManagerScript>();
    }