コード例 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        MonoBehaviour[] list = collision.gameObject.GetComponents <MonoBehaviour>();
        collision.gameObject.GetComponents <MonoBehaviour>();
        foreach (MonoBehaviour mb in list)
        {
            if (mb is PlayerController)
            {
                if (sH == null)
                {
                    sH = mb.GetComponent <PlayerStationHandler>();
                }

                sH.SethighlighStation(this);
                interactible = true;
            }
        }
    }
コード例 #2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (!interactible)
        {
            return;
        }

        MonoBehaviour[] list = collision.gameObject.GetComponents <MonoBehaviour>();
        collision.gameObject.GetComponents <MonoBehaviour>();
        foreach (MonoBehaviour mb in list)
        {
            if (mb is PlayerController)
            {
                if (sH == null)
                {
                    sH = mb.GetComponent <PlayerStationHandler>();
                }

                sH.ResetHighlightStation();
                interactible = false;
            }
        }
    }