Пример #1
0
 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)
     });
 }
Пример #2
0
    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));
    }