public bool SE_CheckForPinHasFallen() { //GetOwner().PrintString("SE_CheckForPinHasFallen", FLinearColor.Green, printToLog: true); FVector _rotationInEuler = MyOwner.GetActorRotation().Euler(); float _tiltInX = FMath.Abs(_rotationInEuler.X); float _tiltInY = FMath.Abs(_rotationInEuler.Y); bool _previouslyFallen = bPinHasFallen; bPinHasFallen = _tiltInX > standingThreshold || _tiltInY > standingThreshold; if (bDebugInstantStrike) { bPinHasFallen = true; } if (bPinHasFallen && _previouslyFallen != bPinHasFallen) { gamemaster.CallOnPinHasFallen(this); } else if (bPinHasFallen == false && _previouslyFallen != bPinHasFallen && bDebugInstantStrike == false) { //If Pin Has Gotten Back Up Because //Pin Has Fallen, But Now PinHasFallen Equals False //MyOwner.PrintString("Pin has gotten back up", FLinearColor.Green, printToLog: true); gamemaster.CallOnPinHasGottenBackUp(this); } return(bPinHasFallen); }
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); }
void AttachToParentWithOldPosition() { var _pinManagerBP = pinManager.MyOwner; FHitResult _hit; FVector _oldLoc = MyOwner.GetActorLocation(); FRotator _oldRot = MyOwner.GetActorRotation(); MyOwner.AttachToActor(_pinManagerBP, _pinManagerBP.GetAttachParentSocketName(), EAttachmentRule.KeepRelative, EAttachmentRule.KeepRelative, EAttachmentRule.KeepWorld, true); MyOwner.SetActorLocation(_oldLoc, false, out _hit, false); MyOwner.SetActorRotation(_oldRot, false); }
void NudgeBallRight(float famount) { FHitResult _hit; MyOwner.SetActorLocation( MyOwner.GetActorLocation() + new FVector(0, famount, 0), false, out _hit, false); if (BallNudgeSound != null) { MyAudioSourceComponent.Sound = BallNudgeSound; MyAudioSourceComponent.Play(); } }
public void OnShowRoomTips(MsgRoomShowTips msg) { MyOwner.AppendLog($"{MyPlayer.UserId}: {msg.tips}\r\n"); if (string.IsNullOrWhiteSpace(msg.tips)) { return; } if (MyOwner.CheckBoxAutoAction.IsChecked == true) { DoAutoAction(msg.tips); } }
public override void BeginPlay() { //base.ReceiveBeginPlay_Implementation(); //LaunchBall(); gamemaster.BowlTurnIsFinished += BowlTurnIsFinished; gamemaster.BowlNewTurnIsReady += NewTurnIsReady; //gamemaster.BowlTurnIsFinishedTest.Bind(BowlTurnIsFinished); gamemaster.OnBallLaunch += LaunchBall; gamemaster.OnNudgeBallLeft += NudgeBallLeft; gamemaster.OnNudgeBallRight += NudgeBallRight; MyStartLocation = MyOwner.GetActorLocation(); MyStartRotation = MyOwner.GetActorRotation(); }
public void OnHandScore(MsgHandOver msg) { if (MyOwner.IsPlaying) { MyOwner.IsPlaying = false; MyOwner.AppendLog("[end]\r\n"); var handoverType = msg.endType; switch (handoverType) { case (int)HandOverType.enumHandOverType_None: MyOwner.AppendLog("流局\r\n"); break; case (int)HandOverType.enumHandOverType_Win_SelfDrawn: MyOwner.AppendLog("自摸胡牌\r\n"); break; case (int)HandOverType.enumHandOverType_Win_Chuck: MyOwner.AppendLog("放铳胡牌\r\n"); break; } } var handScore = msg.scores; if (handScore == null) { return; } var myScore = handScore.playerScores.FirstOrDefault(playerScore => playerScore.targetChairID == MyPlayer.ChairId); if (myScore == null) { return; } TbScore.Text = myScore.score.ToString(); if (MyOwner.IsFirstPlayer(MyPlayer)) { var scoreMsg = FormatScore(msg); MyOwner.ShowScoreWnd(scoreMsg); } }
public void OnHandScore(MsgHandOver msg) { if (MyOwner.IsPlaying) { MyOwner.IsPlaying = false; MyOwner.AppendLog("[end]\r\n"); var handoverType = msg.EndType; switch (handoverType) { case (int)HandOverType.EnumHandOverTypeNone: MyOwner.AppendLog("平局\r\n"); break; case (int)HandOverType.EnumHandOverTypeWin: MyOwner.AppendLog("赢牌\r\n"); break; case (int)HandOverType.EnumHandOverTypeLoss: MyOwner.AppendLog("输牌\r\n"); break; } } var handScore = msg.Scores; if (handScore == null) { return; } var myScore = handScore.PlayerScores.FirstOrDefault(playerScore => playerScore.TargetChairID == MyPlayer.ChairId); if (myScore == null) { return; } TbScore.Text = myScore.TotalScore.ToString(); if (MyOwner.IsFirstPlayer(MyPlayer)) { var scoreMsg = FormatScore(msg); MyOwner.ShowScoreWnd(scoreMsg); } }
/**the behaviors that happen when a mask is clicked depends on the turn phase. Masks can be clicked on to be flipped, * masks can also be clicked on to choose a target for delivery**/ public void MaskClick() { switch (GameManager.instance.MyGameState) { case Game_State.Flipping: if (MyOwner.myMaskList.Count > 0) { MyOwner.RemoveMask(); } break; case Game_State.SelectWhom: if (MainPlayer.instance.MyCovertIntention == CovertIntention.Deliver) { //Debug.Log ("Select whom is active"); Briefcase_Type brf_color = MainPlayer.instance.MyBriefCaseSelect.myBriefCaseType; MyOwner.transform.FindChild("brf_inPossession").gameObject.SetActive(true); switch (brf_color) { case Briefcase_Type.GREY: MyOwner.transform.FindChild("brf_inPossession").gameObject.GetComponent <Image>().color = Color.grey; break; case Briefcase_Type.YELLOW: //new Color(233,193,5,1) MyOwner.transform.FindChild("brf_inPossession").gameObject.GetComponent <Image>().color = Color.yellow; break; case Briefcase_Type.RED: //new Color(173,25,25,1) MyOwner.transform.FindChild("brf_inPossession").gameObject.GetComponent <Image>().color = Color.red; break; default: break; } } MainPlayer.instance.SetSelectWhomSelection(MyOwner); //Debug.Log ("I selected "+MyOwner.Index); MainPlayer.instance.DeliverWhom = MyOwner; break; default: break; } }
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); } }
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); }
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(); } }
/// <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 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(); } }
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); } } }
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 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 bool CanHitActor(IGameActor touchedActor) { bool canHitActor = true; if (touchedActor == null) { canHitActor = false; } else if (touchedActor.IsDodging()) { canHitActor = false; } else if (MyOwner != null && touchedActor.GetTribe() == MyOwner.GetTribe()) { canHitActor = false; } else if (actorsHitbyProjectile.TryGetValue(MyId, out List <IGameActor> actors) && actors.Contains(touchedActor)) { // Don't let a bullet hit the same character multiple times. canHitActor = false; } return(canHitActor); }
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(); }