private bool ValidateSpace(Game game, PlayerLocation location) { var state = (GameActionState)Enum.Parse(typeof(GameActionState), location.ToString()); var action = new GameAction { State = state, Location = game.CurrentTurn.CurrentAction.Location }; var invoker = new ActionContextInvoker(game); return(invoker.IsValidTransition(action)); }
private void PrintCurrentState() { stateText.transform.parent.position = transform.position + new Vector3(0, 4.25f, 0); stateText.text = playerState.ToString() + "\n" + playerLocation.ToString() + "\n" + "AG : " + almostGrounded; Debug.DrawLine(transform.position, transform.position - new Vector3(0, groundedCheckLength, 0), Color.red); Debug.DrawLine(transform.position - new Vector3(0.05f, 0, 0), transform.position - new Vector3(0.05f, almostGroundedCheckLength, 0), Color.blue); Debug.DrawLine(transform.position - (isRotated ? -1 : 1) * new Vector3(secondaryGroundedCheckOffset, 0, 0), transform.position - new Vector3((isRotated ? -1 : 1) * secondaryGroundedCheckOffset, groundedCheckLength, 0), Color.red); Debug.DrawLine(transform.position - (isRotated ? -1 : 1) * new Vector3(secondaryGroundedCheckOffset - 0.05f, 0, 0), transform.position - new Vector3((isRotated ? -1 : 1) * (secondaryGroundedCheckOffset - 0.05f), almostGroundedCheckLength, 0), Color.blue); }
}; //used to get html friendly names to use in id fields, format: { (key) location, (value) { location name, first action, second action } #endregion Fields #region Constructors public ActionSpaceViewModel(string userName, Game game, PlayerLocation location) { Game = game; IsActivePlayer = FormHelper.IsActivePlayer(userName, game); IsValidSpace = ValidateSpace(game, location); Location = location; State = (GameActionState)Enum.Parse(typeof(GameActionState), location.ToString()); LocationName = HtmlNames[location][0]; FirstActionName = HtmlNames[location][1]; SecondActionName = HtmlNames[location][2]; Color = game.Players.First(p => p.UserName == userName).Color; SetGalleristColorClass(game, location); SetPushAndPullByLocation(location); }
public ActionSpaceViewModel(string userName, Game game, PlayerLocation location) { Game = game; IsActivePlayer = FormHelper.IsActivePlayer(userName, game); IsValidSpace = ValidateSpace(game, location); Location = location; State = (GameActionState)Enum.Parse(typeof(GameActionState), location.ToString()); LocationName = HtmlNames[location][0]; FirstActionName = HtmlNames[location][1]; SecondActionName = HtmlNames[location][2]; Color = game.Players.First(p => p.UserName == userName).Color; SetGalleristColorClass(game, location); SetPushAndPullByLocation(location); }
private bool ValidateSpace(Game game, PlayerLocation location) { var state = (GameActionState)Enum.Parse(typeof(GameActionState), location.ToString()); var action = new GameAction { State = state, Location = game.CurrentTurn.CurrentAction.Location }; var invoker = new ActionContextInvoker(game); return invoker.IsValidTransition(action); }