コード例 #1
0
 private void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.gameObject.CompareTag("Player"))
     {
         inRange = false;
         gameObject.SetActive(false);
         enemyParent.triggerArea.SetActive(true);
         enemyParent.inRange = false;
         enemyParent.SelectTarget();
     }
 }
コード例 #2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Player") && !anim.GetBool("Death"))
        {
            //Debug.Log("HotZoneLeft");

            //healthbar.transform.position = new Vector3(0, -1000, 0);
            inRange = false;
            gameObject.SetActive(false);
            enemyParent.triggerArea.SetActive(true);
            enemyParent.inRange = false;
            enemyParent.SelectTarget();
            anim.SetBool("Attack", false);
            healthbar.transform.position = new Vector3(0, -1000, 0);
            GetComponentInParent <MobHealthBar>().hurt = false;
        }
    }
コード例 #3
0
ファイル: EnemyHealth.cs プロジェクト: Mucsi20/Demigod-Stuff
    void Update()
    {
        if (WallDetection())
        {
            //Debug.Log("WALLLLLLLLLLLLLL!!!!!");
            if (!enemy_behaviour.InsideofLimits() && /*!enemy_behaviour.inRange && */ !enemy_behaviour.anim.GetCurrentAnimatorStateInfo(0).IsName("Skeleton_attack") && !enemy_behaviour.anim.GetCurrentAnimatorStateInfo(0).IsName("Skeleton_rage"))
            {
                enemy_behaviour.SelectTarget();
                Invoke("TrigAreaActive", 1);
            }
        }

        if (currentHealth <= 0)
        {
            canFlip = false;
            enemy_behaviour.anim.SetBool("IsDead", true);
            rb.constraints = RigidbodyConstraints2D.FreezeAll;
            Die();
        }
    }