// Use this for initialization void Start() { gameDifficulty = (int)PlayerPrefsManager.GetDifficulty(); maxHealth = gameDifficulty + 2; //enemy health indicated by value of difficulty shooting = false; player = FindObjectOfType <PlayerController>(); movingRight = false; currentHealth = maxHealth; enemyHealthCanvas.enabled = false; //do not show health bar at first enemyHealthBar.ChangeMaxValue(maxHealth); enemyHealthBar.resourceValue = currentHealth; }
// Use this for initialization void Start() { gameDifficulty = (int)PlayerPrefsManager.GetDifficulty(); originalMaxHealth = Mathf.Clamp((5 - gameDifficulty) * 3 + 4, 5f, 15f); //player max health depends on game difficulty maxHealth = (int)originalMaxHealth; facingLeft = false; facingRight = false; isGrounded = true; speedMultiplier = 1f; superpower = 0; currentHealth = maxHealth; healthBar.resourceValue = currentHealth; healthBar.ChangeMinValue(0f); healthBar.ChangeMaxValue(maxHealth); shieldBar.resourceValue = 0f; shieldBar.ChangeMinValue(0f); shieldBar.ChangeMaxValue(1f); playerAnimator = GetComponent <Animator>(); jetpackAudioSource = GetComponent <AudioSource>(); jetpackAudioSource.mute = true; //jetpack sound will only be unmuted if it is being used ableToShoot = true; canTakeDamage = true; }