Exemple #1
0
                // TODO: Replace SendMessage by the interface ILivingBeing
                // TODO: The arrow isn't pined properly
                /* If the arrow hits an enemy, call GotHit to its gameObject */
                private void OnCollisionEnter2D(Collision2D collision)
                {
                    ILivingBeing lb = collision.gameObject.GetComponent <ILivingBeing>();

                    if (lb != null)
                    {
                        lb.GotHit(1);
                    }

                    GetComponent <Rigidbody2D>().velocity        = Vector2.zero;
                    GetComponent <Rigidbody2D>().angularVelocity = 0F;

                    Destroy(GetComponent <Rigidbody2D>());
                    Destroy(GetComponent <BoxCollider2D>());
                    transform.SetParent(collision.gameObject.transform);
                }
 public Parent(ILivingBeing child)
 {
     _child = child;
 }