public bool TryExecuteMove(UnitBase executingUnit, IUnitMove moveToExecute) { // Invoke move implementation based on dynamic polymorphism: bool status = ExecuteMoveInternal(executingUnit, (dynamic)moveToExecute); // Update visible positions after move if (status) { _gameInstanceService.UpdateVisiblePositionsForTeam(executingUnit.Player.Team); } return(status); }
// Implementations of the different moves in partial classes // Acts as a catch-all for dynamic polymorphism: private bool ExecuteMoveInternal(UnitBase unit, IUnitMove move) => false;