Beispiel #1
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.gameObject.layer == wallLayer || collider.gameObject.layer == platformLayer)
     {
         // if it's environment, stop
         state              = GROUNDED;
         rbody.velocity     = Vector2.zero;
         rbody.gravityScale = 0;
         landAudioSource.Play();
     }
     else if (collider.gameObject.layer == playerLayer)
     {
         DummyController dummy = collider.gameObject.GetComponent <DummyController>();
         if (dummy && state == IN_AIR)
         {
             dummy.Kill();
             return;
         }
         PlayerController player = collider.gameObject.GetComponent <PlayerController>();
         if (player == firingPlayer && timer > 0)
         {
             return;
         }
         if (player == null)
         {
             return;
         }
         if (state == IN_AIR)
         {
             player.Kill();
         }
         else
         {
             // pick up
             player.numArrows++;
             Destroy(gameObject);
         }
     }
 }