public void Update() { if (this.enPhase == CatchMode.Phase.None) { return; } Game1 master = Program.GetTheGame(); if (master.xLocalPlayer != this.xView) { return; } if (!Utility.IsWithinRange((int)this.xView.xEntity.xRenderComponent.iActiveAnimation, 2100, 2299) && this.xView.xEntity.xRenderComponent.iActiveAnimation != 83) { this.EndCatch(); return; } if (this.enPhase == CatchMode.Phase.WaitingForBaitedEnemy) { return; } if (this.enPhase == CatchMode.Phase.Minigame) { this.xGame.Update(); if (this.xGame.iFails >= this.xGame.iMaxFails) { this.Lose(); return; } if (this.xGame.iCounter >= this.xGame.iTimeToSurvive) { this.Win(); return; } } else if (this.enPhase == CatchMode.Phase.Victory) { this.iTimeSinceWinOrLose++; if (this.iTimeSinceWinOrLose == 40) { this.iTimeSinceWinOrLose = 0; this.enPhase = CatchMode.Phase.VictoryPrompt; return; } } else { if (this.enPhase == CatchMode.Phase.VictoryPrompt) { this.iTimeSinceWinOrLose++; return; } if (this.enPhase == CatchMode.Phase.VictoryPromptClose) { this.iTimeSinceWinOrLose++; if (this.iTimeSinceWinOrLose >= 10) { this.EndCatch(); return; } } else if (this.enPhase == CatchMode.Phase.Losing) { this.iTimeSinceWinOrLose++; if (this.iTimeSinceWinOrLose >= 30) { this.EndCatch(); this.xView.xEntity.xRenderComponent.SwitchAnimation((ushort)this.xView.xEntity.byAnimationDirection, Animation.CancelOptions.IgnoreIfPlaying); } } } }
public void Win() { this.enPhase = CatchMode.Phase.Victory; }
public void TryCatch(EnemyBehaviour xBehaviour) { this.xBehaviour = xBehaviour; xBehaviour.xCatchMode = this; this.enPhase = CatchMode.Phase.WaitingForBaitedEnemy; xBehaviour.xCatchMode = this; this.iTimeSinceWinOrLose = 0; xBehaviour.ToBeCaught(); this.xRC.cColor = Color.White; this.xRC.fAlpha = 1f; this.xRC.fScale = 1f; this.iCatchChoise = 0; if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server) { NetOutgoingMessage om = this.CreateMessage(); om.Write(1); om.Write(xBehaviour.xOwner.iID); this.SendMessage(om); } }
public void ProcessInput(LocalInputHelper xGameInput, LocalInputHelper xMenuInput) { if (this.enPhase == CatchMode.Phase.Minigame) { if (xMenuInput.Up.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Up); return; } if (xMenuInput.Right.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Right); return; } if (xMenuInput.Down.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Down); return; } if (xMenuInput.Left.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Left); return; } if (xMenuInput.Attack.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Sword); return; } if (xMenuInput.Shield.bPressed) { this.xGame.Input(CatchMode.Game.Arrow.ArrowType.Shield); return; } } else if (this.enPhase == CatchMode.Phase.VictoryPrompt) { if (xMenuInput.Right.bPressed || xMenuInput.Left.bPressed) { this.iCatchChoise = (this.iCatchChoise + 1) % 2; Program.GetTheGame().xSoundSystem.PlayInterfaceCue("Menu_Move"); return; } if (xMenuInput.Action.bPressed) { Program.GetTheGame().xSoundSystem.PlayInterfaceCue("Menu_Changed"); this.CatchChoise(); this.iTimeSinceWinOrLose = 0; this.enPhase = CatchMode.Phase.VictoryPromptClose; } } }
public void Lose() { this.enPhase = CatchMode.Phase.Losing; this.iTimeSinceWinOrLose = 0; }
public void EnterMiniGame() { this.xBehaviour.xOwner.EnterLockedState(); string sAssetName = "GoldenCarrot"; if (this.xBehaviour.xOwner.enType == EnemyCodex.EnemyTypes.GreenSlime) { sAssetName = "JuicyApple"; } else if (this.xBehaviour.xOwner.enType == EnemyCodex.EnemyTypes.Pumpkin) { sAssetName = "Polka"; } this.xView.xEntity.xRenderComponent.dixAnimations[2100].xTextureSet.ltxRenderOnTop[0] = Program.game.Content.Load<Texture2D>("Sprites/Heroes/PetFeed/Item/" + sAssetName + "/Start"); this.xView.xEntity.xRenderComponent.dixAnimations[2101].xTextureSet.ltxRenderOnTop[0] = Program.game.Content.Load<Texture2D>("Sprites/Heroes/PetFeed/Item/" + sAssetName + "/Start"); this.xView.xEntity.xRenderComponent.dixAnimations[2102].xTextureSet.ltxRenderOnTop[0] = Program.game.Content.Load<Texture2D>("Sprites/Heroes/PetFeed/Item/" + sAssetName + "/Lure"); this.xView.xEntity.xRenderComponent.dixAnimations[2103].xTextureSet.ltxRenderOnTop[0] = Program.game.Content.Load<Texture2D>("Sprites/Heroes/PetFeed/Item/" + sAssetName + "/Lure"); if (this.xBehaviour.xOwner.xTransform.v2Pos.X > this.xView.xEntity.xTransform.v2Pos.X) { this.xView.xEntity.xRenderComponent.SwitchAnimation(2100, Animation.CancelOptions.IgnoreIfPlaying); } else { this.xView.xEntity.xRenderComponent.SwitchAnimation(2101, Animation.CancelOptions.IgnoreIfPlaying); } this.enPhase = CatchMode.Phase.Minigame; if (Program.GetTheGame().xLocalPlayer != this.xView) { NetOutgoingMessage om = this.CreateMessage(); om.Write(2); om.Write(this.xBehaviour.xOwner.iID); this.SendMessage(om); return; } this.xGame.StartNewGame(this.xBehaviour.xOwner.enType); Program.GetTheGame().xRenderMaster.RegisterGUIRenderComponent(this.xRC); if (Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client) { this.xView.xEntity.EnterLockedState(); } else { Program.GetTheGame()._Player_ClientRequestLockedState(true); } if (Program.GetTheGame().xLocalPlayer == this.xView) { Program.GetTheGame().xStolenInput = this; } }
public void EndCatch() { if (this.enPhase == CatchMode.Phase.None) { return; } this.enPhase = CatchMode.Phase.None; this.xBehaviour.EndCatch(); this.xBehaviour.xOwner.ExitLockedState(); this.xBehaviour.xCatchMode = null; this.xBehaviour = null; Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.xRC); if (Program.GetTheGame().xStolenInput == this) { Program.GetTheGame().xStolenInput = null; } if (Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client) { this.xView.xEntity.ExitLockedState(); } if (Utility.IsWithinRange((int)this.xView.xEntity.xRenderComponent.iActiveAnimation, 2100, 2299)) { if (this.xView.xEntity.byAnimationDirection == 1) { this.xView.xEntity.xRenderComponent.SwitchAnimation(2104, Animation.CancelOptions.IgnoreIfPlaying); } else if (this.xView.xEntity.byAnimationDirection == 3) { this.xView.xEntity.xRenderComponent.SwitchAnimation(2105, Animation.CancelOptions.IgnoreIfPlaying); } else { this.xView.xEntity.xRenderComponent.SwitchAnimation((ushort)this.xView.xEntity.byAnimationDirection, Animation.CancelOptions.IgnoreIfPlaying); } } if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Server || (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client && this.xView == Program.GetTheGame().xLocalPlayer)) { NetOutgoingMessage om = this.CreateMessage(); om.Write(4); this.SendMessage(om); } }