Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!isDie && ai.Ai_Trigger(collision, GreenDie))
     {
         isDie = true;
         if (!GreenDie)
         {
             GreenDie = true;
             ai.SetEnemyDie(false);
             anim.SetTrigger("hit");
             ai.speed *= angrySpeed;
             ai.SetTime(0);
         }
         else
         {
             anim.SetBool("isDie", true);
         }
     }
 }
Beispiel #2
0
 void Update()
 {
     if (isFirstHit)
     {
         GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
         ai.moveSpots = groundSpot;
         ai.speed    *= 2;
         ai.SetIndex(0);
         ai.SetTime(waitTime);
         isFirstHit = false;
         //isDie = false;
         anim.SetBool("hit", true);
         Instantiate(leafsPrefab, transform.position, Quaternion.identity);
     }
     else if (anim.GetBool("hit") && GetComponent <Rigidbody2D>().velocity.y < 0.1f)
     {
         transform.localScale = new Vector3(1, 1, 1);
         anim.SetBool("hit", false);
     }
     ai.Move(true);
     anim.SetBool("run", ai.GetIsMove());
 }