示例#1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (CharacterColor.CompareColor(_sprite.color, collision.transform.Find("Body").GetComponent <SpriteRenderer>().color))
     {
         Physics2D.IgnoreCollision(collision.transform.GetComponent <BoxCollider2D>(), transform.GetComponent <BoxCollider2D>());
     }
 }
示例#2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player") && CharacterColor.CompareColor(collision.transform.Find("Body").GetComponent <SpriteRenderer>().color, neededColor.GetColor(_colorIndex)))
     {
         controller.currentColors.RemoveColor(neededColor.GetColor(_colorIndex));
         controller.playersInGame.Remove(collision.gameObject);
         //controller.characterIndex = 0;
         controller.SetActiveCharacter(0);
         Destroy(collision.gameObject);
         _colorIndex++;
         onDeliverColor.Invoke(this, new onDeliverColorEventArgs {
             index = _colorIndex
         });
     }
 }