void OnTriggerStay2D(Collider2D col)
 {
     if (atc.move_direction != 0)
     {
         return;
     }
     if (col.gameObject.tag == Common_data.PANDA_TAG)
     {
         panda_controller p_c = col.gameObject.GetComponent <panda_controller> ();
         if (p_c.move_direction > 0)
         {
             if (is_attact == true)
             {
                 return;
             }
         }
         else if (p_c.move_direction == 0)
         {
             is_attact = false;
             return;
         }
         else if (p_c.move_direction < 0)
         {
             return;
         }
         is_attact = true;
         bullet_controller b_c = bullet.GetComponent <bullet_controller>();
         b_c.move_direction = this.move_direction;
         atc.fire_attact();
         Instantiate(bullet, transform.position, bullet.transform.rotation);
     }
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     if (atc.move_direction != 0)
     {
         return;
     }
     if (col.gameObject.tag == Common_data.PANDA_TAG)
     {
         bullet_controller b_c = bullet.GetComponent <bullet_controller>();
         b_c.move_direction = this.move_direction;
         atc.fire_attact();
         Instantiate(bullet, transform.position, bullet.transform.rotation);
         is_attact = true;
     }
 }
Beispiel #3
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "bullet")
     {
         bullet_controller bc = col.GetComponent <bullet_controller>();
         if (bc.parentId == 7)
         {
             return;
         }
         if (playerId != 0 && bc.parentId != playerId)
         {
             reflectAud.Play();
             bc.parentId = 7;
             bc.transform.Rotate(new Vector3(0, 180, 0));
             bc.speed             = bc.speed / 2;
             reflectEffectTimer   = reflectEffectTime;
             transform.localScale = new Vector3(1.1f, 1.1f, 1.1f);
         }
         else
         {
             gettingHit.Play();
             health -= bullet_controller.damage;
             transform.localScale = new Vector3(.9f, 1f, .9f);
             hitEffectTimer       = hitEffectTime;
             if (health <= 0)
             {
                 deathAud.Play();
                 Destroy(gameObject);
                 if (!dead)
                 {
                     ++b_level1.killCount;
                 }
                 dead = true;
                 Debug.Log(b_level1.killCount);
                 return;
             }
         }
         Vector3 healthSize = startHealthSize;
         healthSize.x            *= health / maxHealth;
         healthDisplay.localScale = healthSize;
     }
 }