//Funktionen public List<ICommand> getTypeCommands(clsUnit CallingUnit) { Move cmd = new Move(); cmd.Unit = CallingUnit; List<ICommand> cmdlist = new List<ICommand>(); cmdlist.Add(cmd); return cmdlist; }
private void createMoveCommandsForSektor(Sektor aktSek, int intFieldsMoved) { foreach (clsSektorKoordinaten aktVektor in m_DirectionVektors) { Sektor newSek = this.FieldField.move(aktSek, aktVektor); if (newSek != null && aktSek.strUniqueID != newSek.strUniqueID) { if (!m_listKnownMovements.Contains(newSek.strUniqueID)) { m_listKnownMovements.Add(newSek.strUniqueID); Move readyCmd = new Move(); readyCmd.Unit = m_Unit; readyCmd.CommandId = Guid.NewGuid().ToString(); readyCmd.OriginSektor = m_originSektor; Sektor targetSek = this.FieldField.get(newSek.objSektorKoord); readyCmd.TargetSektor = targetSek; raiseOnNewMoveCommand(readyCmd); } int intNewFieldsMoved = intFieldsMoved + newSek.intMoveCost; if (intNewFieldsMoved < m_Unit.intMovement) { createMoveCommandsForSektor(newSek, intNewFieldsMoved); } } } }
private void raiseOnNewMoveCommand(Move readyCmd) { if (onNewMoveCommand != null) onNewMoveCommand(readyCmd); }