예제 #1
0
    // Use this for initialization
    void Start()
    {
        // Set jack name
        gameObject.name = "Jack_" + Id;
        if (!Board)
        {
            GameObject  goBoard = GameObject.Find("switchboard");
            Switchboard brd     = goBoard.GetComponent <Switchboard>();
            if (brd)
            {
                _board = brd;
            }
        }
        _board.RegisterJack(this);
        _lightControl = GetComponent <LightController>();
        _audioSource  = GetComponent <AudioSource>();

        // Subscribe to snapzone events
        _snapDropZone = GetComponentInChildren <VRTK_SnapDropZone>();
        _snapDropZone.ObjectSnappedToDropZone     += new SnapDropZoneEventHandler(OnSnap);
        _snapDropZone.ObjectUnsnappedFromDropZone += new SnapDropZoneEventHandler(OnUnsnap);
    }