Example #1
0
 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> ();
    }
Example #3
0
            public override string ToString()
            {
                string heroName = HeroName + "\n";
                string HP       = "  HP: " + HeroHealth.ToString() + "\n";
                string MP       = "  MP: " + HeroMana.ToString();

                return(heroName + HP + MP);
            }
Example #4
0
    // Use this for initialization
    void Start()
    {
        playerTarget = GameObject.FindGameObjectWithTag("Player").transform;

        hero = FindObjectOfType <HeroHealth>();

        batBod = GetComponent <Rigidbody2D>();
    }
Example #5
0
 public void Init(int playerCount)
 {
     Debug.Log($"Init Hero State with {playerCount} heroes");
     heroHealth   = HeroHealth.Healthy;
     isHealthy    = true;
     hasActivated = new bool[2] {
         false, false
     };
 }
Example #6
0
    // Use this for initialization
    void Start()
    {
        heroRigidBody = GetComponent <Rigidbody2D>();
        movementAnim  = GetComponent <Animator>();
        heroFeet      = GetComponent <CircleCollider2D>();
        hero          = GetComponent <HeroHealth>();

        gravityAtStart = heroRigidBody.gravityScale;
    }
Example #7
0
    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>();
    }
Example #8
0
    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);
        }
    }
Example #9
0
 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);
     }
 }
Example #10
0
    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);
    }
Example #11
0
 // Use this for initialization
 void Start()
 {
     playerTarget = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
     hero         = FindObjectOfType <HeroHealth>();
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     hero       = GetComponent <HeroHealth>();
     attackAnim = GetComponent <Animator>();
     nextStrike = Time.time;
 }
Example #13
0
 // Use this for initialization
 void Start()
 {
     health    = GetComponent <HeroHealth>();
     maxHealth = maxHearts * healthPerHeart;
     CheckHealthAmount();
 }
Example #14
0
 void Awake()
 {
     herohealth = FindObjectOfType <HeroHealth>();
 }