Example #1
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Bullet")
     {
         itembox.GiveItem(GameManager.GetInstance().m_cPlayer);
         if (itembox.Drop)
         {
             Instantiate(IngredientPrefab, transform.position, transform.rotation);
             Instantiate(DeathEffect, transform.position, transform.rotation);
         }
         RespawnBox();
     }
 }
Example #2
0
 void Dead()
 {
     if (isDie == true)
     {
         isDie = false;
         monster.isKinematic = true;
         GetComponent <NavMeshAgent>().enabled = false;
         hp = hpmax;
         GameManager.GetInstance().m_cPlayer.exp = GameManager.GetInstance().m_cPlayer.exp + exp;
         RespawnMonster();
         itembox.GiveItem(GameManager.GetInstance().m_cPlayer);
     }
 }
Example #3
0
 void Update()
 {
     if (Time.time > nextAttackTime)
     {
         float sqrDstToTarget = (target.position - transform.position).sqrMagnitude;
         if (sqrDstToTarget < Mathf.Pow(attackDistanceThreshold + myCollisionRadius + targetCollisionRadius, 2))
         {
             nextAttackTime = Time.time + timeBetweenAttacks;
             StartCoroutine(Attack());
         }
     }
     if (RespawnDone == 1)
     {
         accumulator += Time.deltaTime;
     }
     if (accumulator >= Respawn)
     {
         transform.position = RespawnPos.transform.position;
         RespawnDone        = 0;
         accumulator        = 0.0f;
         GetComponent <NavMeshAgent>().enabled = true;
     }
     if (hp <= 0)
     {
         isDie = true;
         itembox.GiveItem(GameManager.GetInstance().m_cPlayer);
         if (itembox.Drop)
         {
             Instantiate(IngredientPrefab, transform.position, transform.rotation);
             Instantiate(DeathEffect, transform.position, transform.rotation);
         }
     }
     if (isHit == true)
     {
         isHit = false;
     }
     Dead();
 }