Ejemplo n.º 1
0
    void MoveForceSlider(Slider slider)
    {
        if (!cueController.allIsSleeping)
        {
            return;
        }

        if (cueController.NetworkSlaveInControl() || cueController.BotInControl() || cueController.NetworkBotInControl())
        {
            return;
        }

        cueController.cueForceisActive = true;
        cueForceValue        = slider.Value;
        transform.localScale = new Vector3(slider.Value, 1.0f, 1.0f);
        mesr.sharedMaterial.SetTextureScale("_MainTex", new Vector2(1.0f, slider.Value));

        cueController.cueDisplacement = cueController.cueMaxDisplacement * cueForceValue;
    }
Ejemplo n.º 2
0
    IEnumerator StatusUpdateStillPositions(int inShotCount, bool inPlayerInControl, bool inPushoutable, bool inSkippable, int inStatus, bool[] inPocketed, Vector3[] inPositions, bool inFirstTime)
    {
        while (cueController == null)
        {
            yield return(null);
        }

        yield return(new WaitForEndOfFrame());

        bool ControlReallyChanged = ServerController.serverController.playerInControl != inPlayerInControl;

        ServerController.serverController.playerInControl = inPlayerInControl;

        if (ControlReallyChanged && !inFirstTime)
        {
            float transfer_volume = Mathf.Clamp01(1.0f);

            if (ServerController.serverController.playerInControl)
            {
                GameManager_script.Instance().PlaySound((int)MusicClip.Good_Transfer, false, transfer_volume); // getting control always cheers
            }
            else
            {
                GameManager_script.Instance().PlaySound((int)MusicClip.Bad_Transfer, false, transfer_volume); // losing control always sad
            }
        }

        CueControllerUpdater.current_control_status = inStatus;

        cueController.pushoutAllowed = inPushoutable;
        cueController.skipAllowed    = inSkippable;

        cueController.stillBallPositions = inPositions;
        cueController.stillBallPocketed  = inPocketed;

        StartCoroutine(UpdateStillPositions(inShotCount));

        cueController.ConditionalEnableForceSlider(); // update force slider control

        // activate hand cursor
        if (CueControllerUpdater.current_control_status == CueControllerUpdater.CUE_BALL_MOVABLE_ON_TABLE && inPlayerInControl && !inFirstTime)
        {
            cueController.ActivateHandCursor();
        }

        // increment balls missed (when we transfer control over to player while it being on table)
        if (CueControllerUpdater.current_control_status == CueControllerUpdater.CUE_BALL_FIXED_ON_TABLE && inPlayerInControl && !inSkippable)
        {
            GameManager_script.IncrementShotsMissed(cueController.TrackingShotAsPlayerOne, cueController.TrackingShotAsPlayerTwo);
        }

        // show breakz pushout
        if (inFirstTime)
        {
            cueController.ShowHelpfulTooltipPopup("", "YourBreak", true, false);

            if (cueController.BotInControl() || cueController.NetworkSlaveInControl() || cueController.NetworkBotInControl()) // set for rematch breaks
            {
                GameManager_script.Instance().rematchYouAreThePrevBreaker = false;
            }
            else
            {
                GameManager_script.Instance().rematchYouAreThePrevBreaker = true;
            }
        }
    }