Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DisabledPlayer disabledPlayer = collision.GetComponent <DisabledPlayer> ();

        //print (collision.tag + " | é null? " + (disabledPlayer == null));

        if (disabledPlayer != null)
        {
            disabledPlayer.Destroy();
        }
    }
Example #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponent <Player> () != null)
        {
            GameManager manager = FindObjectOfType <GameManager> ();
            if (manager != null)
            {
                manager.DisableCurrentPlayer(false);
            }
        }
        else
        {
            DisabledPlayer disabledPlayer = collision.GetComponent <DisabledPlayer> ();

            if (disabledPlayer != null)
            {
                disabledPlayer.Destroy();
            }
        }
    }
Example #3
0
    void CheckCollisions(float moveDistance)
    {
        Ray2D        ray = new Ray2D(transform.position, transform.right);
        RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.right, 0.1f);

        if (hit)
        {
            Player player = hit.collider.GetComponent <Player> ();
            if (player != null)
            {
                player.TakeHit();
            }
            else
            {
                DisabledPlayer disabledPlayer = hit.collider.GetComponent <DisabledPlayer> ();
                if (disabledPlayer != null)
                {
                    disabledPlayer.Destroy();
                }
            }
            Destroy(gameObject);
        }
    }