Exemplo n.º 1
0
    public override void OnControllerEnter(PlayerViveController currentController)
    {
        base.OnControllerEnter(currentController);

        playerController = currentController;
        playerHand       = playerController.GetCurrentHand();
    }
Exemplo n.º 2
0
    public override void OnControllerEnter(PlayerViveController currentController)
    {
        base.OnControllerEnter(currentController);

        if (m_Toggled == false)
        {
            m_Toggled = true;

            if (currentController != null)
            {
                var source = currentController.GetCurrentHand();
                currentController.Vibration(0, 0.7f, 10, 1, source);
            }

            GetComponent <AudioPlayer>().Play();

            GetComponent <Renderer>().material.SetColor("_Color", Color.green);
            m_Train.GetComponent <TrainArriver>().BeginArrival(() =>
            {
                transform.Find("AnnouncementBeep").GetComponent <AudioPlayer>().Play();
            });

            transform.DOLocalMoveX(m_ToggleOffset, 0.2f).SetRelative();
        }
    }
Exemplo n.º 3
0
    public override void OnControllerEnter(PlayerViveController currentController)
    {
        base.OnControllerEnter(currentController);

        if (bIsBroken)
        {
            return;
        }

        if (ActivateCount >= BreakAtCount)
        {
            ownedLights.bIsOn = true;
            ownedLights.ToggleLights();
            bIsBroken   = true;
            bSwitchIsOn = false;
            var rigidbody = transform.GetComponent <Rigidbody>();
            rigidbody.useGravity             = true;
            rigidbody.isKinematic            = false;
            rigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous;
            bCount = true;
            return;
        }

        Audio.Play();

        var source = currentController.GetCurrentHand();

        currentController.Vibration(0, 0.2f, 5, 1, source);

        if (bSwitchIsOn)
        {
            bSwitchIsOn = false;

            transform.localRotation = Quaternion.Euler(0, 0, -90);

            ownedLights.ToggleLights();
        }
        else
        {
            bSwitchIsOn    = true;
            ActivateCount += 1;

            transform.localRotation = Quaternion.Euler(0, 0, 0);

            ownedLights.ToggleLights();
        }
    }