public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Direction.started -= m_Wrapper.m_GameActionsCallbackInterface.OnDirection; @Direction.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnDirection; @Direction.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnDirection; @Click.started -= m_Wrapper.m_GameActionsCallbackInterface.OnClick; @Click.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnClick; @Click.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnClick; @Escape.started -= m_Wrapper.m_GameActionsCallbackInterface.OnEscape; @Escape.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnEscape; @Escape.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnEscape; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Direction.started += instance.OnDirection; @Direction.performed += instance.OnDirection; @Direction.canceled += instance.OnDirection; @Click.started += instance.OnClick; @Click.performed += instance.OnClick; @Click.canceled += instance.OnClick; @Escape.started += instance.OnEscape; @Escape.performed += instance.OnEscape; @Escape.canceled += instance.OnEscape; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @UI.started -= m_Wrapper.m_GameActionsCallbackInterface.OnUI; @UI.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnUI; @UI.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnUI; @Aim.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; @Aim.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; @Aim.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @UI.started += instance.OnUI; @UI.performed += instance.OnUI; @UI.canceled += instance.OnUI; @Aim.started += instance.OnAim; @Aim.performed += instance.OnAim; @Aim.canceled += instance.OnAim; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Roll.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRoll; @Roll.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRoll; @Roll.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRoll; @Thrust.started -= m_Wrapper.m_GameActionsCallbackInterface.OnThrust; @Thrust.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnThrust; @Thrust.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnThrust; @Look.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Fire.started -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Roll.started += instance.OnRoll; @Roll.performed += instance.OnRoll; @Roll.canceled += instance.OnRoll; @Thrust.started += instance.OnThrust; @Thrust.performed += instance.OnThrust; @Thrust.canceled += instance.OnThrust; @Look.started += instance.OnLook; @Look.performed += instance.OnLook; @Look.canceled += instance.OnLook; @Fire.started += instance.OnFire; @Fire.performed += instance.OnFire; @Fire.canceled += instance.OnFire; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Attack.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Attack.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Attack.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Zoom.started -= m_Wrapper.m_GameActionsCallbackInterface.OnZoom; @Zoom.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnZoom; @Zoom.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnZoom; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Attack.started += instance.OnAttack; @Attack.performed += instance.OnAttack; @Attack.canceled += instance.OnAttack; @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @Zoom.started += instance.OnZoom; @Zoom.performed += instance.OnZoom; @Zoom.canceled += instance.OnZoom; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Start.started -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; @Start.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; @Start.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Quit.started -= m_Wrapper.m_GameActionsCallbackInterface.OnQuit; @Quit.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnQuit; @Quit.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnQuit; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Start.started += instance.OnStart; @Start.performed += instance.OnStart; @Start.canceled += instance.OnStart; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; @Quit.started += instance.OnQuit; @Quit.performed += instance.OnQuit; @Quit.canceled += instance.OnQuit; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @UnlimitedTime.started -= m_Wrapper.m_GameActionsCallbackInterface.OnUnlimitedTime; @UnlimitedTime.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnUnlimitedTime; @UnlimitedTime.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnUnlimitedTime; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @ScreenShot.started -= m_Wrapper.m_GameActionsCallbackInterface.OnScreenShot; @ScreenShot.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnScreenShot; @ScreenShot.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnScreenShot; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @UnlimitedTime.started += instance.OnUnlimitedTime; @UnlimitedTime.performed += instance.OnUnlimitedTime; @UnlimitedTime.canceled += instance.OnUnlimitedTime; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; @ScreenShot.started += instance.OnScreenShot; @ScreenShot.performed += instance.OnScreenShot; @ScreenShot.canceled += instance.OnScreenShot; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Jump.started -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Drop.started -= m_Wrapper.m_GameActionsCallbackInterface.OnDrop; @Drop.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnDrop; @Drop.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnDrop; @Dance.started -= m_Wrapper.m_GameActionsCallbackInterface.OnDance; @Dance.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnDance; @Dance.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnDance; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @Jump.started += instance.OnJump; @Jump.performed += instance.OnJump; @Jump.canceled += instance.OnJump; @Drop.started += instance.OnDrop; @Drop.performed += instance.OnDrop; @Drop.canceled += instance.OnDrop; @Dance.started += instance.OnDance; @Dance.performed += instance.OnDance; @Dance.canceled += instance.OnDance; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Move.cancelled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Aim.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; Aim.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; Aim.cancelled -= m_Wrapper.m_GameActionsCallbackInterface.OnAim; Throw.started -= m_Wrapper.m_GameActionsCallbackInterface.OnThrow; Throw.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnThrow; Throw.cancelled -= m_Wrapper.m_GameActionsCallbackInterface.OnThrow; Start.started -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; Start.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; Start.cancelled -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { Move.started += instance.OnMove; Move.performed += instance.OnMove; Move.cancelled += instance.OnMove; Aim.started += instance.OnAim; Aim.performed += instance.OnAim; Aim.cancelled += instance.OnAim; Throw.started += instance.OnThrow; Throw.performed += instance.OnThrow; Throw.cancelled += instance.OnThrow; Start.started += instance.OnStart; Start.performed += instance.OnStart; Start.cancelled += instance.OnStart; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Tap.started -= m_Wrapper.m_GameActionsCallbackInterface.OnTap; @Tap.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnTap; @Tap.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnTap; @Position.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPosition; @Position.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPosition; @Position.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPosition; @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Tap.started += instance.OnTap; @Tap.performed += instance.OnTap; @Tap.canceled += instance.OnTap; @Position.started += instance.OnPosition; @Position.performed += instance.OnPosition; @Position.canceled += instance.OnPosition; @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; } }
public void BeforeDiceRoll(IGameState state, IGameActions actions) { if (!silent) { Console.WriteLine(id + ": Before dice roll"); } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Rock.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRock; @Rock.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRock; @Rock.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRock; @Paper.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPaper; @Paper.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPaper; @Paper.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPaper; @Scissors.started -= m_Wrapper.m_GameActionsCallbackInterface.OnScissors; @Scissors.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnScissors; @Scissors.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnScissors; @Prepared.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPrepared; @Prepared.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPrepared; @Prepared.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPrepared; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Rock.started += instance.OnRock; @Rock.performed += instance.OnRock; @Rock.canceled += instance.OnRock; @Paper.started += instance.OnPaper; @Paper.performed += instance.OnPaper; @Paper.canceled += instance.OnPaper; @Scissors.started += instance.OnScissors; @Scissors.performed += instance.OnScissors; @Scissors.canceled += instance.OnScissors; @Prepared.started += instance.OnPrepared; @Prepared.performed += instance.OnPrepared; @Prepared.canceled += instance.OnPrepared; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { Walk.started -= m_Wrapper.m_GameActionsCallbackInterface.OnWalk; Walk.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnWalk; Walk.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnWalk; Shoot.started -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; Shoot.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; Shoot.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; Interact.started -= m_Wrapper.m_GameActionsCallbackInterface.OnInteract; Interact.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnInteract; Interact.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnInteract; Menu.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; Menu.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; Menu.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; Camera.started -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; Camera.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; Camera.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; MoveItemSelectorUp.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorUp; MoveItemSelectorUp.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorUp; MoveItemSelectorUp.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorUp; MoveItemSelectorDown.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorDown; MoveItemSelectorDown.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorDown; MoveItemSelectorDown.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveItemSelectorDown; UseItem.started -= m_Wrapper.m_GameActionsCallbackInterface.OnUseItem; UseItem.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnUseItem; UseItem.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnUseItem; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { Walk.started += instance.OnWalk; Walk.performed += instance.OnWalk; Walk.canceled += instance.OnWalk; Shoot.started += instance.OnShoot; Shoot.performed += instance.OnShoot; Shoot.canceled += instance.OnShoot; Interact.started += instance.OnInteract; Interact.performed += instance.OnInteract; Interact.canceled += instance.OnInteract; Menu.started += instance.OnMenu; Menu.performed += instance.OnMenu; Menu.canceled += instance.OnMenu; Camera.started += instance.OnCamera; Camera.performed += instance.OnCamera; Camera.canceled += instance.OnCamera; MoveItemSelectorUp.started += instance.OnMoveItemSelectorUp; MoveItemSelectorUp.performed += instance.OnMoveItemSelectorUp; MoveItemSelectorUp.canceled += instance.OnMoveItemSelectorUp; MoveItemSelectorDown.started += instance.OnMoveItemSelectorDown; MoveItemSelectorDown.performed += instance.OnMoveItemSelectorDown; MoveItemSelectorDown.canceled += instance.OnMoveItemSelectorDown; UseItem.started += instance.OnUseItem; UseItem.performed += instance.OnUseItem; UseItem.canceled += instance.OnUseItem; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Camera.started -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; @Camera.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; @Camera.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnCamera; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @SailsCounterClockwise.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsCounterClockwise; @SailsCounterClockwise.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsCounterClockwise; @SailsCounterClockwise.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsCounterClockwise; @SailsClockwise.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsClockwise; @SailsClockwise.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsClockwise; @SailsClockwise.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSailsClockwise; @Turbo.started -= m_Wrapper.m_GameActionsCallbackInterface.OnTurbo; @Turbo.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnTurbo; @Turbo.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnTurbo; @Anchor.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAnchor; @Anchor.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAnchor; @Anchor.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAnchor; @Bucket.started -= m_Wrapper.m_GameActionsCallbackInterface.OnBucket; @Bucket.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnBucket; @Bucket.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnBucket; @Cannon.started -= m_Wrapper.m_GameActionsCallbackInterface.OnCannon; @Cannon.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnCannon; @Cannon.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnCannon; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Camera.started += instance.OnCamera; @Camera.performed += instance.OnCamera; @Camera.canceled += instance.OnCamera; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; @SailsCounterClockwise.started += instance.OnSailsCounterClockwise; @SailsCounterClockwise.performed += instance.OnSailsCounterClockwise; @SailsCounterClockwise.canceled += instance.OnSailsCounterClockwise; @SailsClockwise.started += instance.OnSailsClockwise; @SailsClockwise.performed += instance.OnSailsClockwise; @SailsClockwise.canceled += instance.OnSailsClockwise; @Turbo.started += instance.OnTurbo; @Turbo.performed += instance.OnTurbo; @Turbo.canceled += instance.OnTurbo; @Anchor.started += instance.OnAnchor; @Anchor.performed += instance.OnAnchor; @Anchor.canceled += instance.OnAnchor; @Bucket.started += instance.OnBucket; @Bucket.performed += instance.OnBucket; @Bucket.canceled += instance.OnBucket; @Cannon.started += instance.OnCannon; @Cannon.performed += instance.OnCannon; @Cannon.canceled += instance.OnCannon; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @MoveLeft.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveLeft; @MoveLeft.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveLeft; @MoveLeft.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveLeft; @MoveRight.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveRight; @MoveRight.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveRight; @MoveRight.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveRight; @MoveUp.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveUp; @MoveUp.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveUp; @MoveUp.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveUp; @MoveDown.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveDown; @MoveDown.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveDown; @MoveDown.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMoveDown; @ControlUp.started -= m_Wrapper.m_GameActionsCallbackInterface.OnControlUp; @ControlUp.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnControlUp; @ControlUp.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnControlUp; @DiscardControl.started -= m_Wrapper.m_GameActionsCallbackInterface.OnDiscardControl; @DiscardControl.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnDiscardControl; @DiscardControl.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnDiscardControl; @Restart.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; @Restart.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; @Restart.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; @Menu.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; @Menu.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; @Menu.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMenu; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @MoveLeft.started += instance.OnMoveLeft; @MoveLeft.performed += instance.OnMoveLeft; @MoveLeft.canceled += instance.OnMoveLeft; @MoveRight.started += instance.OnMoveRight; @MoveRight.performed += instance.OnMoveRight; @MoveRight.canceled += instance.OnMoveRight; @MoveUp.started += instance.OnMoveUp; @MoveUp.performed += instance.OnMoveUp; @MoveUp.canceled += instance.OnMoveUp; @MoveDown.started += instance.OnMoveDown; @MoveDown.performed += instance.OnMoveDown; @MoveDown.canceled += instance.OnMoveDown; @ControlUp.started += instance.OnControlUp; @ControlUp.performed += instance.OnControlUp; @ControlUp.canceled += instance.OnControlUp; @DiscardControl.started += instance.OnDiscardControl; @DiscardControl.performed += instance.OnDiscardControl; @DiscardControl.canceled += instance.OnDiscardControl; @Restart.started += instance.OnRestart; @Restart.performed += instance.OnRestart; @Restart.canceled += instance.OnRestart; @Menu.started += instance.OnMenu; @Menu.performed += instance.OnMenu; @Menu.canceled += instance.OnMenu; } }
public void BeforeDiceRoll(IGameState state, IGameActions actions) { hasPlayedDevCard = false; if (!state.GetOwnDevelopmentCards().Any(dc => dc != DevelopmentCard.VictoryPoint)) return; //No cards to play Console.WriteLine("Do you want to use a Development Card before roling the dice? Y/N"); var r = Console.ReadLine() ?? ""; if (!r.ToLower().StartsWith("y")) return; PlayDevelopmentCard(state, actions); }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Right.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRight; @Right.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRight; @Right.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRight; @Left.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLeft; @Left.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLeft; @Left.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLeft; @Separuj_Sklo.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Sklo; @Separuj_Sklo.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Sklo; @Separuj_Sklo.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Sklo; @Separuj_Papier.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Papier; @Separuj_Papier.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Papier; @Separuj_Papier.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Papier; @Separuj_Plasty.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Plasty; @Separuj_Plasty.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Plasty; @Separuj_Plasty.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSeparuj_Plasty; @Game.started -= m_Wrapper.m_GameActionsCallbackInterface.OnGame; @Game.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnGame; @Game.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnGame; @End_Game.started -= m_Wrapper.m_GameActionsCallbackInterface.OnEnd_Game; @End_Game.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnEnd_Game; @End_Game.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnEnd_Game; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Right.started += instance.OnRight; @Right.performed += instance.OnRight; @Right.canceled += instance.OnRight; @Left.started += instance.OnLeft; @Left.performed += instance.OnLeft; @Left.canceled += instance.OnLeft; @Separuj_Sklo.started += instance.OnSeparuj_Sklo; @Separuj_Sklo.performed += instance.OnSeparuj_Sklo; @Separuj_Sklo.canceled += instance.OnSeparuj_Sklo; @Separuj_Papier.started += instance.OnSeparuj_Papier; @Separuj_Papier.performed += instance.OnSeparuj_Papier; @Separuj_Papier.canceled += instance.OnSeparuj_Papier; @Separuj_Plasty.started += instance.OnSeparuj_Plasty; @Separuj_Plasty.performed += instance.OnSeparuj_Plasty; @Separuj_Plasty.canceled += instance.OnSeparuj_Plasty; @Game.started += instance.OnGame; @Game.performed += instance.OnGame; @Game.canceled += instance.OnGame; @End_Game.started += instance.OnEnd_Game; @End_Game.performed += instance.OnEnd_Game; @End_Game.canceled += instance.OnEnd_Game; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; Start.started -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; Start.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; Start.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnStart; Back.started -= m_Wrapper.m_GameActionsCallbackInterface.OnBack; Back.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnBack; Back.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnBack; Action1.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAction1; Action1.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAction1; Action1.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAction1; Action2.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAction2; Action2.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAction2; Action2.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAction2; Action3.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAction3; Action3.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAction3; Action3.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAction3; Action4.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAction4; Action4.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAction4; Action4.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAction4; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { Move.started += instance.OnMove; Move.performed += instance.OnMove; Move.canceled += instance.OnMove; Start.started += instance.OnStart; Start.performed += instance.OnStart; Start.canceled += instance.OnStart; Back.started += instance.OnBack; Back.performed += instance.OnBack; Back.canceled += instance.OnBack; Action1.started += instance.OnAction1; Action1.performed += instance.OnAction1; Action1.canceled += instance.OnAction1; Action2.started += instance.OnAction2; Action2.performed += instance.OnAction2; Action2.canceled += instance.OnAction2; Action3.started += instance.OnAction3; Action3.performed += instance.OnAction3; Action3.canceled += instance.OnAction3; Action4.started += instance.OnAction4; Action4.performed += instance.OnAction4; Action4.canceled += instance.OnAction4; } }
public ScoreBoard(IGameActions actions, IUndoActions undo) { if (undo == null) { throw new ArgumentNullException("undo"); } if (actions == null) { throw new ArgumentNullException("actions"); } this.boardActions = actions; this.undoBoard = undo; }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Mouse.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMouse; @Mouse.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMouse; @Mouse.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMouse; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Mouse.started += instance.OnMouse; @Mouse.performed += instance.OnMouse; @Mouse.canceled += instance.OnMouse; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Newaction.started -= m_Wrapper.m_GameActionsCallbackInterface.OnNewaction; @Newaction.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnNewaction; @Newaction.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnNewaction; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Newaction.started += instance.OnNewaction; @Newaction.performed += instance.OnNewaction; @Newaction.canceled += instance.OnNewaction; } }
public void BeforeDiceRoll(IGameState state, IGameActions actions) { hasPlayedDevCard = false; if (!state.GetOwnDevelopmentCards().Any(dc => dc != DevelopmentCard.VictoryPoint)) { return; //No cards to play } Console.WriteLine("Do you want to use a Development Card before roling the dice? Y/N"); var r = Console.ReadLine() ?? ""; if (!r.ToLower().StartsWith("y")) { return; } PlayDevelopmentCard(state, actions); }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @exit.started -= m_Wrapper.m_GameActionsCallbackInterface.OnExit; @exit.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnExit; @exit.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnExit; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @exit.started += instance.OnExit; @exit.performed += instance.OnExit; @exit.canceled += instance.OnExit; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Movement.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Movement.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Movement.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Jump.started -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Look.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Sprint.started -= m_Wrapper.m_GameActionsCallbackInterface.OnSprint; @Sprint.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnSprint; @Sprint.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnSprint; @Attack.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Attack.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Attack.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAttack; @Ready.started -= m_Wrapper.m_GameActionsCallbackInterface.OnReady; @Ready.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnReady; @Ready.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnReady; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Movement.started += instance.OnMovement; @Movement.performed += instance.OnMovement; @Movement.canceled += instance.OnMovement; @Jump.started += instance.OnJump; @Jump.performed += instance.OnJump; @Jump.canceled += instance.OnJump; @Look.started += instance.OnLook; @Look.performed += instance.OnLook; @Look.canceled += instance.OnLook; @Sprint.started += instance.OnSprint; @Sprint.performed += instance.OnSprint; @Sprint.canceled += instance.OnSprint; @Attack.started += instance.OnAttack; @Attack.performed += instance.OnAttack; @Attack.canceled += instance.OnAttack; @Ready.started += instance.OnReady; @Ready.performed += instance.OnReady; @Ready.canceled += instance.OnReady; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Fire.started -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Run.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRun; @Run.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRun; @Run.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRun; @Pickup.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPickup; @Pickup.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPickup; @Pickup.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPickup; @PutDown.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPutDown; @PutDown.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPutDown; @PutDown.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPutDown; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @Fire.started += instance.OnFire; @Fire.performed += instance.OnFire; @Fire.canceled += instance.OnFire; @Run.started += instance.OnRun; @Run.performed += instance.OnRun; @Run.canceled += instance.OnRun; @Pickup.started += instance.OnPickup; @Pickup.performed += instance.OnPickup; @Pickup.canceled += instance.OnPickup; @PutDown.started += instance.OnPutDown; @PutDown.performed += instance.OnPutDown; @PutDown.canceled += instance.OnPutDown; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; } }
public void Init(IGameActions gameActions, IBoardQuery boardQuery, IDeck deck) { if (gameActions == null) { throw new ArgumentNullException("gameActions"); } if (boardQuery == null) { throw new ArgumentNullException("boardQuery"); } if (deck == null) { throw new ArgumentNullException("deck"); } this.gameActions = gameActions; this.boardQuery = boardQuery; this.deck = deck; }
private IGameState PlayDevelopmentCard(IGameState state, IGameActions actions) { Console.WriteLine("Which development card do you wish to play:"); Console.WriteLine("0) None"); int i = 1; var cards = new Dictionary <int, DevelopmentCard>(); foreach (var c in state.GetOwnDevelopmentCards().Where(c => c != DevelopmentCard.VictoryPoint)) { Console.WriteLine(i + ") " + c); cards.Add(i, c); i++; } int selection = int.Parse(Console.ReadLine() ?? "0"); if (selection == 0) { return(null); } Console.WriteLine("You played the card " + cards[selection]); hasPlayedDevCard = true; switch (cards[selection]) { case DevelopmentCard.Knight: return(actions.PlayKnight()); case DevelopmentCard.Monopoly: Console.WriteLine("Choose the resource type to get monopoly on"); return(actions.PlayMonopoly(selectResource())); case DevelopmentCard.RoadBuilding: Console.WriteLine("Decide where to build the two roads"); var road1 = getRoadPosition(); var road2 = getRoadPosition(); return(actions.PlayRoadBuilding(road1, road2)); case DevelopmentCard.YearOfPlenty: Console.WriteLine("Choose which two resources you want to draw"); return(actions.PlayYearOfPlenty(selectResource(), selectResource())); } return(null); }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @LayerCam.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam; @LayerCam.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam; @LayerCam.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam; @LayerCam1.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam1; @LayerCam1.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam1; @LayerCam1.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam1; @LayerCam2.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam2; @LayerCam2.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam2; @LayerCam2.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam2; @LayerCam3.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam3; @LayerCam3.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam3; @LayerCam3.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam3; @LayerCam4.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam4; @LayerCam4.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam4; @LayerCam4.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLayerCam4; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @LayerCam.started += instance.OnLayerCam; @LayerCam.performed += instance.OnLayerCam; @LayerCam.canceled += instance.OnLayerCam; @LayerCam1.started += instance.OnLayerCam1; @LayerCam1.performed += instance.OnLayerCam1; @LayerCam1.canceled += instance.OnLayerCam1; @LayerCam2.started += instance.OnLayerCam2; @LayerCam2.performed += instance.OnLayerCam2; @LayerCam2.canceled += instance.OnLayerCam2; @LayerCam3.started += instance.OnLayerCam3; @LayerCam3.performed += instance.OnLayerCam3; @LayerCam3.canceled += instance.OnLayerCam3; @LayerCam4.started += instance.OnLayerCam4; @LayerCam4.performed += instance.OnLayerCam4; @LayerCam4.canceled += instance.OnLayerCam4; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Movement.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Movement.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Movement.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMovement; @Rotation.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRotation; @Rotation.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRotation; @Rotation.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRotation; @Fire.started -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Fire.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnFire; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Restart.started -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; @Restart.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; @Restart.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnRestart; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Movement.started += instance.OnMovement; @Movement.performed += instance.OnMovement; @Movement.canceled += instance.OnMovement; @Rotation.started += instance.OnRotation; @Rotation.performed += instance.OnRotation; @Rotation.canceled += instance.OnRotation; @Fire.started += instance.OnFire; @Fire.performed += instance.OnFire; @Fire.canceled += instance.OnFire; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; @Restart.started += instance.OnRestart; @Restart.performed += instance.OnRestart; @Restart.canceled += instance.OnRestart; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Move.started -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Move.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnMove; @Jump.started -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Jump.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnJump; @Action.started -= m_Wrapper.m_GameActionsCallbackInterface.OnAction; @Action.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnAction; @Action.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnAction; @Pause.started -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @Pause.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnPause; @QTE.started -= m_Wrapper.m_GameActionsCallbackInterface.OnQTE; @QTE.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnQTE; @QTE.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnQTE; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Move.started += instance.OnMove; @Move.performed += instance.OnMove; @Move.canceled += instance.OnMove; @Jump.started += instance.OnJump; @Jump.performed += instance.OnJump; @Jump.canceled += instance.OnJump; @Action.started += instance.OnAction; @Action.performed += instance.OnAction; @Action.canceled += instance.OnAction; @Pause.started += instance.OnPause; @Pause.performed += instance.OnPause; @Pause.canceled += instance.OnPause; @QTE.started += instance.OnQTE; @QTE.performed += instance.OnQTE; @QTE.canceled += instance.OnQTE; } }
public void SetCallbacks(IGameActions instance) { if (m_Wrapper.m_GameActionsCallbackInterface != null) { @Look.started -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Look.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnLook; @Shoot.started -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; @Shoot.performed -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; @Shoot.canceled -= m_Wrapper.m_GameActionsCallbackInterface.OnShoot; } m_Wrapper.m_GameActionsCallbackInterface = instance; if (instance != null) { @Look.started += instance.OnLook; @Look.performed += instance.OnLook; @Look.canceled += instance.OnLook; @Shoot.started += instance.OnShoot; @Shoot.performed += instance.OnShoot; @Shoot.canceled += instance.OnShoot; } }
public void BeforeDiceRoll(IGameState state, IGameActions actions) { if (!silent) Console.WriteLine(id + ": Before dice roll"); }
public GameStateMachine(IGameActions game, IGameSettings settings, GameNotifications gameNotifications) { InstanceState(x => x.Status); DuringAny( When(Tick) .Then(context => context.Instance.LastTick = context.Data.Now)); Initially( When(Tick) .Then(context => context.Instance.LastTick = context.Data.Now) .Then(context => game.MoveGhostsHome()) .Then(context => game.ShowGhosts(context.Instance)) .Then(context => gameNotifications.Publish(GameNotification.Beginning)) .TransitionTo(Scatter)); WhenEnter(Scatter, binder => binder .Then(context => context.Instance.TimeToChangeState = context.Instance.LastTick.AddSeconds(settings.InitialScatterTimeInSeconds)) .Then(context => game.ScatterGhosts())); During(Scatter, When(Tick, context => context.Data.Now >= context.Instance.TimeToChangeState) .TransitionTo(GhostChase)); WhenEnter(GhostChase, binder => binder .Then(context => context.Instance.TimeToChangeState = context.Instance.LastTick.AddSeconds(settings.ChaseTimeInSeconds)) .Then(context => game.GhostToChase())); During(GhostChase, When(Tick, context => context.Data.Now >= context.Instance.TimeToChangeState) .TransitionTo(Scatter)); During(Frightened, When(Tick, context => context.Data.Now >= context.Instance.TimeToChangeState) .Then(x => game.MakeGhostsNotEdible()) .TransitionTo(Scatter)); During(Scatter, GhostChase, Frightened, When(Tick) .ThenAsync(async context => await game.MoveGhosts(context, this)) .Then(context => game.MovePacMan(context, this)), When(CoinEaten) .Then(context => context.Instance.Score += 10) .Then(context => gameNotifications.Publish(GameNotification.EatCoin)), When(PowerPillEaten) .Then(context => context.Instance.Score += 50) .Then(context => gameNotifications.Publish(GameNotification.EatPowerPill)) .Then(context => game.MakeGhostsEdible()) .Then(context => context.Instance.TimeToChangeState = context.Instance.LastTick.AddSeconds(7)) .TransitionTo(Frightened), When(GhostCollision) .IfElse(x => x.Data.Ghost.Edible, binder => binder.Then(x => game.SendGhostHome(x.Data.Ghost)), binder => binder.Then(context => context.Instance.Lives -= 1) .TransitionTo(Dying))); WhenEnter(Dying, binder => binder .Then(context => context.Instance.TimeToChangeState = context.Instance.LastTick.AddSeconds(4)) .Then(context => gameNotifications.Publish(GameNotification.Dying))); During(Dying, When(Tick, context => context.Data.Now >= context.Instance.TimeToChangeState) .Then(context => game.HideGhosts(context.Instance)) .Then(context => context.Instance.TimeToChangeState = context.Data.Now.AddSeconds(4)) .IfElse(context => context.Instance.Lives > 0, binder => binder.TransitionTo(Respawning), binder => binder.TransitionTo(Dead))); WhenEnter(Respawning, binder => binder .Then(context => gameNotifications.Publish(GameNotification.Respawning))); During(Respawning, When(Tick, context => context.Data.Now >= context.Instance.TimeToChangeState) .Then(context => context.Instance.TimeToChangeState = context.Data.Now.AddSeconds(4)) .Then(context => game.MoveGhostsHome()) .Then(context => game.MovePacManHome()) .Then(context => game.ShowGhosts(context.Instance)) .TransitionTo(GhostChase)); During(Dead, Ignore(Tick)); }
public void PerformTurn(IGameState state, IGameActions actions) { Console.WriteLine("It is now your turn (#" + assignedId + ")"); while (true) { try { Console.Write("Resources: ["); foreach (Resource resource in Enum.GetValues(typeof (Resource))) { var count = state.GetOwnResources().Count(r => r == resource); if (count == 0) continue; Console.Write(resource + " x " + count + ", "); } Console.WriteLine("]"); Console.Write("Dev. cards: ["); foreach (DevelopmentCard devcard in Enum.GetValues(typeof(DevelopmentCard))) { var count = state.GetOwnDevelopmentCards().Count(r => r == devcard); if (count == 0) continue; Console.Write(devcard + " x " + count + ", "); } Console.WriteLine("]"); bool canBuildRoad = hasRes(state, Resource.Lumber) && hasRes(state, Resource.Brick); //TODO: has any more pieces bool canBuildSettlement = hasRes(state, Resource.Brick) && hasRes(state, Resource.Lumber) && hasRes(state, Resource.Grain) && hasRes(state, Resource.Wool); //TODO: has any more pieces bool canBuildCity = hasRes(state, Resource.Ore, 3) && hasRes(state, Resource.Grain, 2); //TODO: has any more pieces bool canBuyDevCard = hasRes(state, Resource.Grain) && hasRes(state, Resource.Ore) && hasRes(state, Resource.Wool); //TODO: any more dev cards bool canTradeBank = true, canTradePlayers = true; //TODO: Implement these Console.WriteLine("Choose an action:"); Console.WriteLine("0) End turn"); if (canBuildRoad) Console.WriteLine("1) Build road"); if (canBuildSettlement) Console.WriteLine("2) Build settlement"); if (canBuildCity) Console.WriteLine("3) Build city"); if (canBuyDevCard) Console.WriteLine("4) Buy development card"); if (!hasPlayedDevCard && state.GetOwnDevelopmentCards().Count(d => d != DevelopmentCard.VictoryPoint) > 0) Console.WriteLine("5) Play development card"); if (canTradeBank) Console.WriteLine("6) Trade resources with the bank"); if (canTradePlayers) Console.WriteLine("7) Trade resources with the other players"); int answer = int.Parse(Console.ReadLine() ?? "0"); switch (answer) { case 1: //road var roadPos = getRoadPosition(); state = actions.BuildRoad(roadPos); break; case 2: //settlement var settlementPos = getSettlementPosition(); state = actions.BuildSettlement(settlementPos); break; case 3: //city var cityPos = getCityPosition(); state = actions.BuildCity(cityPos); break; case 4: //buy dev state = actions.DrawDevelopmentCard(); break; case 5: //play dev state = PlayDevelopmentCard(state, actions) ?? state; break; case 6: //trade bank Console.WriteLine("Choose which resource to give"); var tbGive = selectResourceTradeBank(state.Board); Console.WriteLine("Choose which resource to receive"); var tbTake = selectResource(); state = actions.TradeBank(tbGive, tbTake); break; case 7: //trade players Console.WriteLine("Which resource type do you want to give away:"); var tpGiveType = selectResource(); Console.WriteLine("How many " + tpGiveType + " do you want to give:"); var tpGiveAmount = int.Parse(Console.ReadLine() ?? "2"); Console.WriteLine("Which resource type do you want to get in return for " + tpGiveAmount + " " + tpGiveType + "? :"); var tpTakeType = selectResource(); Console.WriteLine("How many " + tpTakeType + " do you want to get:"); var tpTakeAmount = int.Parse(Console.ReadLine() ?? "1"); var give = new List<List<Resource>>(){new List<Resource>()}; for (int i = 0; i < tpGiveAmount; i++) give[0].Add(tpGiveType); var take = new List<List<Resource>>(){new List<Resource>()}; for (int i = 0; i < tpTakeAmount; i++) take[0].Add(tpTakeType); var feedback = actions.ProposeTrade(give, take); Console.WriteLine("The other players responded:"); foreach (var f in feedback) { Console.Write(f.Key + ") "); Console.Write(f.Value.Status + " "); if (f.Value.Status == TradeStatus.Countered) { Console.Write("(They give: "); Console.Write(f.Value.Give[0].Select(r => r.ToString()).Aggregate((a,b) => a + ", " + b)); Console.Write(" for "); Console.Write(f.Value.Take[0].Select(r => r.ToString()).Aggregate((a, b) => a + ", " + b)); Console.WriteLine(")"); } else { Console.WriteLine(); } } Console.WriteLine("Select a player to trade with by entering the id or -1 to cancel"); int reply = int.Parse(Console.ReadLine() ?? "-1"); if (reply != -1) { state = actions.Trade(reply); } break; default: return; } } catch (AgentActionException ex) { Console.WriteLine("Illegal action! Message: " + ex.Message); } catch(FormatException ex) { Console.WriteLine("Illegal input! Message: " + ex.Message); } } }
private IGameState PlayDevelopmentCard(IGameState state, IGameActions actions) { Console.WriteLine("Which development card do you wish to play:"); Console.WriteLine("0) None"); int i = 1; var cards = new Dictionary<int, DevelopmentCard>(); foreach (var c in state.GetOwnDevelopmentCards().Where(c => c != DevelopmentCard.VictoryPoint)) { Console.WriteLine(i + ") " + c); cards.Add(i, c); i++; } int selection = int.Parse(Console.ReadLine() ?? "0"); if (selection == 0) return null; Console.WriteLine("You played the card " + cards[selection]); hasPlayedDevCard = true; switch (cards[selection]) { case DevelopmentCard.Knight: return actions.PlayKnight(); case DevelopmentCard.Monopoly: Console.WriteLine("Choose the resource type to get monopoly on"); return actions.PlayMonopoly(selectResource()); case DevelopmentCard.RoadBuilding: Console.WriteLine("Decide where to build the two roads"); var road1 = getRoadPosition(); var road2 = getRoadPosition(); return actions.PlayRoadBuilding(road1, road2); case DevelopmentCard.YearOfPlenty: Console.WriteLine("Choose which two resources you want to draw"); return actions.PlayYearOfPlenty(selectResource(), selectResource()); } return null; }
public void PerformTurn(IGameState state, IGameActions actions) { if (!silent) Console.WriteLine(id + ": Performing main turn"); var resources = ((GameState)state).GetOwnResources(); int[] resCount = new int[5]; foreach (var r in resources) resCount[(int)r]++; if (!silent) Console.Write(id + ": Resources: ( "); foreach (var i in resCount) if (!silent) Console.Write(i + " "); if (!silent) Console.WriteLine(")"); if (hasDevcardToPlay) { hasDevcardToPlay = false; if (!silent) Console.WriteLine("-----------"); if (!silent) Console.WriteLine("Has a dev card to play: " + nextToPlay); switch (nextToPlay) { case DevelopmentCard.Knight: if (!silent) Console.WriteLine("Play knight"); state = ((MainActions) actions).PlayKnight(); break; case DevelopmentCard.Monopoly: if (!silent) Console.WriteLine("Play monopoly"); state = ((MainActions)actions).PlayMonopoly(Resource.Ore); break; case DevelopmentCard.RoadBuilding: if (!silent) Console.WriteLine("Play road building"); state = ((MainActions)actions).PlayRoadBuilding(new Edge(27,28), new Edge(28, 34)); break; case DevelopmentCard.YearOfPlenty: if (!silent) Console.WriteLine("Play year of plenty"); state = ((MainActions)actions).PlayYearOfPlenty(Resource.Grain, Resource.Wool); break; } if (!silent) Console.WriteLine("-----------"); } resources = ((GameState)state).GetOwnResources(); if (resources.Contains(Resource.Grain) && resources.Contains(Resource.Ore) && resources.Contains(Resource.Wool)) { var prevCards = ((GameState) state).GetOwnDevelopmentCards(); state = actions.DrawDevelopmentCard(); if (!silent) Console.WriteLine("Drawn developmentcard successfully"); hasDevcardToPlay = true; var cards = ((GameState) state).GetOwnDevelopmentCards().ToList(); foreach (var developmentCard in prevCards) { cards.Remove(developmentCard); } nextToPlay = cards.ToArray()[0]; } else { try { actions.DrawDevelopmentCard(); if (!silent) Console.WriteLine("WARNING! Was able to buy a development card with not enough resources"); } catch (InsufficientResourcesException e) { if (!silent) Console.WriteLine("exceptions was thrown as excpected"); } } }
public void PerformTurn(IGameState state, IGameActions actions) { if (!silent) Console.WriteLine(id + ": Performing main turn"); for (bool changed = true; changed; ) { changed = false; var resources = state.GetOwnResources(); //Build city if (state.GetCitiesLeft(id) > 0 && resources.Count(r => r == Resource.Grain) >= 2 && resources.Count(r => r == Resource.Ore) >= 3) { var pos = state.Board.GetPossibleCities(id); if (pos.Length > 0) { changed = true; state = actions.BuildCity(FindBestIntersection(pos,state.Board)); } } //Build settlement if (!changed && state.GetSettlementsLeft(id) > 0 && resources.Contains(Resource.Grain) && resources.Contains(Resource.Wool) && resources.Contains(Resource.Lumber) && resources.Contains(Resource.Brick)) { var pos = state.Board.GetPossibleSettlements(id); if (pos.Length > 0) { changed = true; state = actions.BuildSettlement(FindBestIntersection(pos,state.Board)); } } //Build road if (!changed && state.GetRoadsLeft(id) > 0 && resources.Contains(Resource.Lumber) && resources.Contains(Resource.Brick)) { var pos = state.Board.GetPossibleRoads(id); if (pos.Length > 0) { changed = true; state = actions.BuildRoad(FindBestRoad(pos, state.Board)); } } //Trade players if (!changed && Enum.GetValues(typeof(Resource)).Cast<Resource>().Any(r => resources.Count(res => res == r) > 2)) { // trade 1 of most for 1 missing List<List<Resource>> give = resources.OrderByDescending(r => resources.Count(res => res == r)) .GroupBy(r => resources.Count(res => res == r)).First().Distinct() .Select(r => { var list = new List<Resource>(); list.Add(r); return list; }).ToList(); List<List<Resource>> take = Enum.GetValues(typeof(Resource)).Cast<Resource>() .OrderBy(r => resources.Count(res => res == r)) .GroupBy(r => resources.Count(res => res == r)).First() .Select(r => { var list = new List<Resource>(); list.Add(r); return list; }).ToList(); if (give.Count > 0 && take.Count > 0) { Dictionary<int,ITrade> answers = actions.ProposeTrade(give, take); if (answers.Count > 0) { // trade with lowest score int otherPlayer = answers.OrderBy(kv => state.GetPlayerScore(kv.Key)).First().Key; state = actions.Trade(otherPlayer); changed = true; } } } //Trade bank foreach (Resource give in Enum.GetValues(typeof(Resource))) { if (changed) break; if (resources.Count(r => r == give) > 4) { foreach (Resource take in Enum.GetValues(typeof(Resource))) { if (changed) break; if (resources.Count(r => r == take) == 0 && state.ResourceBank[(int)take] > 0) { state = actions.TradeBank(give, take); changed = true; } } } } } }
public void BeforeDiceRoll(IGameState state, IGameActions actions) { // We don't play knights before dice roll }