protected override IList <IInteractionValidator <HandApply> > ValidatorsT2() { return(new List <IInteractionValidator <HandApply> > { IsHand.EMPTY, TargetIs.GameObject(gameObject), CanApply.EVEN_IF_SOFT_CRIT, ComponentAtTargetMatrixPosition <PlayerMove> .MatchingCriteria(pm => pm.IsRestrained) }); }
protected override IList <IInteractionValidator <MouseDrop> > Validators() { return(new List <IInteractionValidator <MouseDrop> > { IsDroppedObjectAtTargetPosition.IS, DoesDroppedObjectHaveComponent <PlayerMove> .DOES, CanApply.EVEN_IF_SOFT_CRIT, ComponentAtTargetMatrixPosition <PlayerMove> .NoneMatchingCriteria(pm => pm.IsRestrained), new FunctionValidator <MouseDrop>(AdditionalValidation) }); }
private ValidationResult AdditionalValidation(MouseDrop drop, NetworkSide side) { //if the player to buckle is currently downed, we cannot buckle if there is another player on the tile //(because buckling a player causes the tile to become unpassable, thus a player could end up //occupying another player's space) var playerMove = drop.UsedObject.GetComponent <PlayerMove>(); var registerPlayer = playerMove.GetComponent <RegisterPlayer>(); if (side == NetworkSide.SERVER ? !registerPlayer.IsDownServer : !registerPlayer.IsDownClient) { return(ValidationResult.SUCCESS); } return(ComponentAtTargetMatrixPosition <PlayerMove> .NoneMatchingCriteria(pm => pm != playerMove && (side == NetworkSide.SERVER ? pm.GetComponent <RegisterPlayer>().IsBlockingServer : pm.GetComponent <RegisterPlayer>().IsBlockingClient)) .Validate(drop, side)); }