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); }
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); }
/// <summary> /// Took Part Of BeginPlay Code Out Because It Depends On Initialization /// Which Should Be Called On Begin Play Inside Blueprints /// </summary> private void MyBeginPlayPostInitialization() { if (pinManager != null) { if (MyColliderMeshComponent != null) { AttachToParentWithOldPosition(); MyColliderMeshComponent.SetSimulatePhysics(false); MyColliderMeshComponent.SetSimulatePhysics(true); } else { MyOwner.PrintString("Please Attach Collider Mesh To Pin Comp UProperty", FLinearColor.Red, printToLog: true); } } else { MyOwner.PrintString("Couldn't Find Pin Manager Component", FLinearColor.Red, printToLog: true); } }
void Debug_Fill18ScoreSlots() { Random _random = new Random(); int _lastMinuteYield = 0; while (BowlTurnCount < 19) { //Currently Set Random Value So That Two Values //Will Never Be Over 10 BowlHelper(_random.Next(0, 6)); //Used To Prevent The Game From Crashing if (BowlTurnCount >= 20 || _lastMinuteYield >= 50) { MyOwner.PrintString("Breaking Out Of Loop, No Crashing!", FLinearColor.Red); break; } _lastMinuteYield++; SetResultsFromFrameTurns(); } }
void LaunchBall(FVector launchVelocity, UBowlingBallComponent bowlingBall) { if (MyMeshComponent == null) { MyOwner.PrintString("Please Assign A mesh component to the uproperty", FLinearColor.OrangeRed); } else if (MyAudioSourceComponent == null) { MyOwner.PrintString("Please Assign an audio component to the uproperty", FLinearColor.OrangeRed); } else if (BallRollingSound == null) { MyOwner.PrintString("Please Assign a sound clip to the ball rolling sound uproperty", FLinearColor.OrangeRed); } else { MyMeshComponent.AddImpulse(launchVelocity, MyMeshComponent.GetAttachSocketName(), true); MyAudioSourceComponent.Sound = BallRollingSound; MyAudioSourceComponent.Play(); } }
protected void ReceiveHitWrapper(UPrimitiveComponent MyComp, AActor Other, UPrimitiveComponent OtherComp, bool SelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, FHitResult Hit) { if (Other != null && Other.ActorHasTag(gamemode.BallTag)) { if (bHitFirstPin.Get(this) == false) { bHitFirstPin.Set(this, true); if (MyAudioSourceComponent == null) { MyOwner.PrintString("Please Assign an audio component to the uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume1 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume1 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume2 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume2 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume3 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume3 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume4 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume4 sound uproperty", FLinearColor.OrangeRed); } else if (PinStrikeSoundVolume5 == null) { MyOwner.PrintString("Please Assign a sound clip to the PinStrikeSoundVolume5 sound uproperty", FLinearColor.OrangeRed); } else { PlayPinStrikeSounds(Other); } } } }
public override void BeginPlay() { MyOwner.World.GetPlayerController(0).ShowMouseCursor = true; List <AActor> ballActors; MyOwner.World.GetAllActorsWithTag(BallTag, out ballActors); SetBallFromBallFindCollection(ballActors); myBowler = MyOwner.World.GetPlayerPawn(0).GetComponentByClass <UMyBowlPlayerComponent>(); StandingPinCount = 10; BowlTurnCount = 1; gamemaster.OnUpdatePinCount += UpdatePinCount; gamemaster.BowlNewTurnIsReady += ResetPinCount; gamemaster.BowlTurnIsFinished += OnTurnIsFinished; gamemaster.OnSendBowlActionResults += OnSendBowlActionResults; gamemaster.Debug_Fill18ScoreSlots += Debug_Fill18ScoreSlots; List <AActor> bowlFloorActors; MyOwner.World.GetAllActorsWithTag(BowlingFloorTag, out bowlFloorActors); if (bowlFloorActors[0] != null) { var _staticActor = bowlFloorActors[0].Cast <AStaticMeshActor>(); if (_staticActor != null) { BowlFloorMeshActor = _staticActor; FVector _origin; FVector _bounds; BowlFloorMeshActor.GetActorBounds(false, out _origin, out _bounds); boundsYLeftEdge = _origin.Y - _bounds.Y; boundsYRightEdge = _origin.Y + _bounds.Y; } else { MyOwner.PrintString("Couldn't Find BowlFloor Blueprint Actor", FLinearColor.Red, printToLog: true); } } }
public void OnStopDrag(FVector2D mousePos) { dragEnd = mousePos; endTime = MyOwner.World.GetGameTimeInSeconds(); float dragDuration = endTime - startTime; //Horizontal float launchSpeedY = (dragEnd.X - dragStart.X) / dragDuration; //Forward float launchSpeedX = (dragStart.Y - dragEnd.Y) / dragDuration; FVector _launchVelocity = new FVector(launchSpeedX * ForwardMultipleVelocityFactor, launchSpeedY, 0); if (_launchVelocity.X > MinimalForwardLaunchVelocity) { StartLaunchingTheBall(_launchVelocity); } else { MyOwner.PrintString("Not Enough Force To Launch!", FLinearColor.Green); } }
public void SetCurrentBowlTurnValue(int _value) { switch (BowlTurnCount) { case 1: Frame01_BowlA = _value; break; case 2: Frame01_BowlB = _value; break; case 3: Frame02_BowlA = _value; break; case 4: Frame02_BowlB = _value; break; case 5: Frame03_BowlA = _value; break; case 6: Frame03_BowlB = _value; break; case 7: Frame04_BowlA = _value; break; case 8: Frame04_BowlB = _value; break; case 9: Frame05_BowlA = _value; break; case 10: Frame05_BowlB = _value; break; case 11: Frame06_BowlA = _value; break; case 12: Frame06_BowlB = _value; break; case 13: Frame07_BowlA = _value; break; case 14: Frame07_BowlB = _value; break; case 15: Frame08_BowlA = _value; break; case 16: Frame08_BowlB = _value; break; case 17: Frame09_BowlA = _value; break; case 18: Frame09_BowlB = _value; break; case 19: Frame10_BowlA = _value; break; case 20: Frame10_BowlB = _value; break; case 21: Frame10_BowlC = _value; break; default: MyOwner.PrintString("Couldn't Set Bowl Turn At: " + BowlTurnCount, FLinearColor.Red, printToLog: true); break; } UpdateBowlTurnFramesBPEvent(); }