예제 #1
0
    public void BallTouchedFinish()
    {
        if (ball.gameObject.transform.parent == null)        // check if ball is wantedly touched while holding in hand
        {
            ///Debug.Log("**** Ball touched Finish, " + starsCollected + ":" + star.Length);///totalStars);
            if (isGameStarted)                     // check if ball is thrown from stage
            {
                if (starsCollected >= star.Length) // check if all stars are collected
                {
                    Debug.Log("Level Finished");
                    ///levelFinished = true;
                    L_mask.SetActive(true);
                    R_mask.SetActive(true);
                    L_maskRend.material.color = winMaskColor;
                    R_maskRend.material.color = winMaskColor;
                    Invoke("ResetMasks", 0.5f);
                    ball.gameObject.SetActive(false);
                    if (currentLevel == totalLevels)
                    {
                        player.nextLevelText_GO.SetActive(false);
                        player.gameOverText_GO.SetActive(true);
                        playerSpeaker.clip = gameOverAudio;

                        L_haptics.VibrateTime(VibrationForce.Hard, 1.5f);
                        R_haptics.VibrateTime(VibrationForce.Hard, 1.5f);
                    }
                    else
                    {
                        playerSpeaker.clip = goalAudio;
                        L_haptics.Vibrate(VibrationForce.Hard);
                        L_haptics.Vibrate(VibrationForce.Hard);
                        L_haptics.Vibrate(VibrationForce.Hard);
                        R_haptics.Vibrate(VibrationForce.Hard);
                        R_haptics.Vibrate(VibrationForce.Hard);
                        R_haptics.Vibrate(VibrationForce.Hard);
                    }

                    playerSpeaker.Play();
                    player.gameOverMenu_GO.SetActive(true);
                    Invoke("ChangeLevel", 3.333f);
                }
                else
                {
                    DisplayMessage("Only " + starsCollected + " of " + star.Length + " star(s) collected!");
                    BallTouchedGround();
                }
            }
            else
            {
                DisplayMessage("Ball must be thrown from the stage");
                BallTouchedGround();
            }
        }
    }
예제 #2
0
    private void OnTriggerEnter(Collider other)
    {
        var enemy = other.GetComponent <Enemy>();

        if (enemy != null)
        {
            enemy.Die();
            intensity      = 0.5f;
            distortStregth = 0.5f;
            color          = Color.red;
            RemoveHeart();
            StartCoroutine(Lhaptics.VibrateTime(VibrationForce.Hard, 1));
            StartCoroutine(Rhaptics.VibrateTime(VibrationForce.Hard, 1));
        }
    }
예제 #3
0
    private void SwitchControllers()
    {
        OVRInput.Controller temp_controller;
        temp_controller = L_controller;
        L_controller    = R_controller;
        R_controller    = temp_controller;

        GameObject temp_controller_GO;

        temp_controller_GO = L_controller_GO;
        L_controller_GO    = R_controller_GO;
        R_controller_GO    = temp_controller_GO;

        OculusHaptics temp_haptics;

        temp_haptics = L_haptics;
        L_haptics    = R_haptics;
        R_haptics    = temp_haptics;

        DisplayMessage("Actions on controllers have switched");
        L_haptics.VibrateTime(VibrationForce.Medium, 1f);
        R_haptics.VibrateTime(VibrationForce.Medium, 1f);
    }