void Damage(Transform enemy) //gets access to enemy's health { HeroHealth health = enemy.GetComponent <HeroHealth>(); { health.Damaged(10); audioManager.PlayHeroHurt(); } }
float timer; // Timer for counting up to the next attack. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <HeroHealth> (); enemyHealth = GetComponent <EnemyHealth>(); anim = GetComponent <Animator> (); }
public override string ToString() { string heroName = HeroName + "\n"; string HP = " HP: " + HeroHealth.ToString() + "\n"; string MP = " MP: " + HeroMana.ToString(); return(heroName + HP + MP); }
// Use this for initialization void Start() { playerTarget = GameObject.FindGameObjectWithTag("Player").transform; hero = FindObjectOfType <HeroHealth>(); batBod = GetComponent <Rigidbody2D>(); }
public void Init(int playerCount) { Debug.Log($"Init Hero State with {playerCount} heroes"); heroHealth = HeroHealth.Healthy; isHealthy = true; hasActivated = new bool[2] { false, false }; }
// Use this for initialization void Start() { heroRigidBody = GetComponent <Rigidbody2D>(); movementAnim = GetComponent <Animator>(); heroFeet = GetComponent <CircleCollider2D>(); hero = GetComponent <HeroHealth>(); gravityAtStart = heroRigidBody.gravityScale; }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; fireballBod = GetComponent <Rigidbody2D>(); moveDirection = (player.transform.position - transform.position).normalized * speed; fireballBod.velocity = new Vector2(moveDirection.x, moveDirection.y + 0.5f); damage = FindObjectOfType <HeroHealth>(); }
void OnTriggerExit2D(Collider2D col) { if (col == null) { return; } // If the player hits the trigger... if (col.gameObject.tag == "Player") { HeroHealth pc = col.gameObject.GetComponent <HeroHealth>(); pc.Kill(); } else { Destroy(col.gameObject); } }
void OnCollisionEnter2D(Collision2D col) { Debug.Log("collision enter"); // If the player hits the trigger... if (col == null) { return; } if (col.gameObject.tag == "Player") { HeroHealth pc = col.gameObject.GetComponent <HeroHealth>(); pc.Kill(); } else { Destroy(col.gameObject); } }
public void SetHealth(HeroHealth heroHealth) { if (cardDescriptor.isDummy) { return; } cardDescriptor.heroState.heroHealth = heroHealth; woundToggle.gameObject.SetActive(false); //skip callback if (heroHealth == HeroHealth.Wounded || heroHealth == HeroHealth.Defeated) { woundToggle.isOn = false; } if (cardDescriptor.heroState.heroHealth == HeroHealth.Defeated) { exhaustedOverlay.SetActive(true); } woundToggle.gameObject.SetActive(true); }
// Use this for initialization void Start() { playerTarget = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); hero = FindObjectOfType <HeroHealth>(); }
// Use this for initialization void Start() { hero = GetComponent <HeroHealth>(); attackAnim = GetComponent <Animator>(); nextStrike = Time.time; }
// Use this for initialization void Start() { health = GetComponent <HeroHealth>(); maxHealth = maxHearts * healthPerHeart; CheckHealthAmount(); }
void Awake() { herohealth = FindObjectOfType <HeroHealth>(); }