Ejemplo n.º 1
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;
            }
        }
    }