public void CallOnSendBowlActionResults(EBowlAction _action)
 {
     if (OnSendBowlActionResults != null)
     {
         OnSendBowlActionResults(_action);
     }
 }
Esempio n. 2
0
        void OnTurnIsFinished()
        {
            EBowlAction _action = Bowl();

            SetResultsFromFrameTurns();
            gamemaster.CallOnSendBowlActionResults(_action);
        }
Esempio n. 3
0
        public EBowlAction BowlHelper(int _pinFall)
        {
            //Old Bowl Method
            SetCurrentBowlTurnValue(_pinFall);
            List <int>  _rolls  = GetBowlTurnListFromCount();
            EBowlAction _action = BowlActionMaster.NextAction(_rolls);

            //Old Bowl Method End
            if (BowlTurnCount >= 21 || _action == EBowlAction.EndGame)
            {
                MyOwner.PrintString("Won Game From C#", FLinearColor.Green, printToLog: true);
                gamemaster.CallOnWinGame();
            }
            else if (BowlTurnCount >= 19)
            {
                BowlTurnCount += 1;
            }
            //If Action Is Tidy Or Bowlturn is the Second One.
            //Second Turns Are Even Except For the Last Few Turns.
            else if (_action == EBowlAction.Tidy ||
                     BowlTurnCount % 2 == 0)
            {
                BowlTurnCount += 1;
            }
            //If Bowl Turn Count Is Not the Second One.
            //Second Turns Are Even Except For the Last Few Turns.
            else if (BowlTurnCount % 2 != 0)
            {
                //Most Likely End Of Turn
                BowlTurnCount += 2;
            }
            return(_action);
        }
Esempio n. 4
0
        void OnSendBowlActionResults(EBowlAction _action)
        {
            if (CleanUpSweepLevelSequence == null ||
                ClearSweepLevelSequence == null)
            {
                MyOwner.PrintString("Please Assign Animation Clips To Clear and Cleanup Level Sequence UProperties", FLinearColor.Red);
                return;
            }

            ALevelSequenceActor  _mySequenceActor;
            ULevelSequencePlayer _myPlayer;
            FMovieSceneSequencePlaybackSettings _settings = new FMovieSceneSequencePlaybackSettings
            {
                StartTime    = 0,
                RestoreState = true,
                PlayRate     = 1.0f
            };

            if (_action != EBowlAction.Tidy)
            {
                _myPlayer = ULevelSequencePlayer.CreateLevelSequencePlayer(this, ClearSweepLevelSequence, _settings, out _mySequenceActor);
            }
            else
            {
                _myPlayer = ULevelSequencePlayer.CreateLevelSequencePlayer(this, CleanUpSweepLevelSequence, _settings, out _mySequenceActor);
            }

            _myPlayer.Play();
            //TODO: Get Accurate Wait For Seconds Length, Used To Be GetLength()
            float _waitLength = 6.0f;

            WaitTillSweepingIsDone(_waitLength, _action);
        }
Esempio n. 5
0
 void BowlNewTurnIsReady(EBowlAction _action)
 {
     if (_action != EBowlAction.Tidy)
     {
         List <AActor> _outPins = RespawnPins();
         InitializePinStandingDictionary(_outPins);
     }
 }
Esempio n. 6
0
 void ResetPinCount(EBowlAction _action)
 {
     if (_action != EBowlAction.Tidy)
     {
         StandingPinCount = 10;
         lastSettledCount = 10;
     }
 }
 public void CallBowlNewTurnIsReady(EBowlAction _action)
 {
     bBowlTurnIsOver = false;
     bCanLaunchBall  = true;
     if (BowlNewTurnIsReady != null)
     {
         BowlNewTurnIsReady(_action);
     }
 }
Esempio n. 8
0
 void NewTurnIsReady(EBowlAction _action)
 {
     MyOwner.SetActorLocation(
         MyStartLocation, false, out myHit, false
         );
     MyOwner.SetActorRotation(
         MyStartRotation, false
         );
 }
        public static EBowlAction NextAction(List <int> rolls)
        {
            EBowlAction nextAction = EBowlAction.Undefined;

            for (int i = 0; i < rolls.Count; i++)
            { // Step through rolls
                if (i == 20)
                {
                    nextAction = EBowlAction.EndGame;
                }
                else if (i >= 18 && rolls[i] == 10)
                { // Handle last-frame special cases
                    nextAction = EBowlAction.Reset;
                }
                else if (i == 19)
                {
                    if (rolls[18] == 10 && rolls[19] == 0)
                    {
                        nextAction = EBowlAction.Tidy;
                    }
                    else if (rolls[18] + rolls[19] == 10)
                    {
                        nextAction = EBowlAction.Reset;
                    }
                    else if (rolls[18] + rolls[19] >= 10)
                    {  // Roll 21 awarded
                        nextAction = EBowlAction.Tidy;
                    }
                    else
                    {
                        nextAction = EBowlAction.EndGame;
                    }
                }
                else if (i % 2 == 0)
                { // First bowl of frame
                    if (rolls[i] == 10)
                    {
                        //rolls.Insert(i, 0); // Insert virtual 0 after strike
                        nextAction = EBowlAction.EndTurn;
                    }
                    else
                    {
                        nextAction = EBowlAction.Tidy;
                    }
                }
                else
                { // Second bowl of frame
                    nextAction = EBowlAction.EndTurn;
                }
            }

            return(nextAction);
        }
        void NewTurnIsReady(EBowlAction _action)
        {
            if (MyMeshComponent == null)
            {
                return;
            }

            MyOwner.SetActorLocation(
                MyStartLocation, false, out myHit, false
                );
            MyOwner.SetActorRotation(
                MyStartRotation, false
                );

            MyMeshComponent.SetSimulatePhysics(false);
            MyMeshComponent.SetSimulatePhysics(true);
        }
Esempio n. 11
0
        void NewBowlTurnHasStarted(EBowlAction _action)
        {
            if (bHitFirstPin.Get(this) == true)
            {
                bHitFirstPin.Set(this, false);
            }

            if (bPinHasFallen)
            {
                //Destroy Pin If It Hasn't Been Sweeped Into the Floor
                MyOwner.DestroyActor();
            }
            else if (MyColliderMeshComponent != null)
            {
                MyColliderMeshComponent.SetSimulatePhysics(true);
            }
        }
Esempio n. 12
0
        void OnSendBowlActionResults(EBowlAction _action)
        {
            var _pinManager = pinManager;

            //Only If Collider Mesh Comp Has Been Assigned AND
            //Parent Actor is the PinManager Actor Blueprint
            if (MyColliderMeshComponent != null &&
                _pinManager != null &&
                bPinHasFallen == false)
            {
                if (_action == EBowlAction.Tidy)
                {
                    AttachToParentWithOldPosition();
                    MyColliderMeshComponent.SetSimulatePhysics(false);
                }
                else
                {
                    MyColliderMeshComponent.SetSimulatePhysics(true);
                }
            }
        }
Esempio n. 13
0
 void CallNewTurnIsReadyAfterWaiting(EBowlAction _action)
 {
     gamemaster.CallBowlNewTurnIsReady(_action);
 }
Esempio n. 14
0
        private IEnumerator WaitTillSweepingIsDoneCoroutine(float _animLength, EBowlAction _action)
        {
            yield return(new WaitForSeconds(_animLength));

            CallNewTurnIsReadyAfterWaiting(_action);
        }
Esempio n. 15
0
 public void WaitTillSweepingIsDone(float _animLength, EBowlAction _action)
 {
     StartCoroutine(WaitTillSweepingIsDoneCoroutine(_animLength, _action));
 }