public bool CanRelocate(IHexCell newLocation) { if (newLocation == null) { throw new ArgumentNullException("newLocation"); } return(PositionCanon.CanChangeOwnerOfPossession(this, newLocation)); }
private void OnCellPointerEntered(IHexCell cell) { if (!IsDragging) { return; } if (cell != null && UnitPositionCanon.CanChangeOwnerOfPossession(SelectedUnit, cell)) { ProspectiveNewLocation = cell; } else { ProspectiveNewLocation = null; } }
private void OnCellPointerEntered(IHexCell cell) { if (!IsDragging) { return; } IUnit attackCandidate = AttackOrderLogic.GetNextAttackTargetOnCell(cell); if (attackCandidate == SelectedUnit) { return; } if (attackCandidate != null && CombatExecuter.CanPerformMeleeAttack(SelectedUnit, attackCandidate)) { SetUnitToAttack(attackCandidate); return; } var cityOnCell = CityLocationCanon.GetPossessionsOfOwner(cell).FirstOrDefault(); if (cityOnCell != null && CombatExecuter.CanPerformMeleeAttack(SelectedUnit, cityOnCell.CombatFacade)) { SetCityToAttack(cityOnCell); return; } var unitLocation = UnitPositionCanon.GetOwnerOfPossession(SelectedUnit); if (unitLocation != cell && UnitPositionCanon.CanChangeOwnerOfPossession(SelectedUnit, cell)) { SetProspectiveTravelGoal(unitLocation, cell); } else { Clear(); } }