Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        enemyCombat = gameObject.GetComponent <EnemyCombat>();
        player      = GameObject.FindGameObjectWithTag("Player");


        if (gameObject.transform.name == "SanguineSludge_Boss")
        {
            BossHeathController bossHeathController = gameObject.GetComponent <BossHeathController>();
            bossHeathController.SetMaxHealth(health);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Checks if arrow has hit an enemy while in the air
    /// </summary>
    /// <param name="col"></param>
    void OnTriggerEnter2D(Collider2D col)
    {
        Debug.Log("Are we here?");
        if (col.tag == "Enemy" && !isGrounded)
        {
            Debug.LogWarning("Hit -----------------------------------");
            col.gameObject.GetComponent <Transform>().parent.transform.gameObject.GetComponent <EnemyM>().health -= 10;
            col.gameObject.GetComponent <Transform>().parent.transform.gameObject.GetComponent <EnemyCombat>().TakeDamage();

            if (col.gameObject.GetComponent <Transform>().parent.name == "SanguineSludge_Boss")
            {
                BossHeathController bossHeathController = col.gameObject.GetComponent <Transform>().parent.transform.gameObject.GetComponent <BossHeathController>();
                bossHeathController.SetHealth(col.gameObject.GetComponent <Transform>().parent.transform.gameObject.GetComponent <EnemyM>().health);
            }

            Destroy(this.gameObject);
        }
    }