Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2022 11:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Gridr - Movement Validation in one asset
[CreateAssetMenu(menuName = "Gridr/Action Condition/ADW/Complete Movement Validation")]
public class CompleteMovementValidation : ActionCondition<GridAction>
public override bool Validate(Cell cell, GridAction action)
return IsInRange(action, cell) && cell.Connected && !cell.Occupied && cell != action.Entity.Cell;
private bool IsInRange(GridAction action, Cell cell)
if (!(action is MovementAction movementAction))
return false;
if (!movementAction.costToCell.ContainsKey(cell))
return true;
return movementAction.costToCell[cell] <=;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment