private void createSolveCommands() { comMove readyCmd = new comMove(m_Unit); readyCmd.OriginSektor = m_originSektor; Sektor targetSek = this.FieldField.dicSektors[m_Unit.MoveHistory_lastSektorID]; readyCmd.TargetSektor = targetSek; this.raiseOnNewCommand(readyCmd); readyCmd = new comMove(m_Unit); readyCmd.OriginSektor = m_originSektor; targetSek = m_originSektor; readyCmd.TargetSektor = targetSek; this.raiseOnNewCommand(readyCmd); }
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); comMove readyCmd = new comMove(m_Unit); readyCmd.OriginSektor = m_originSektor; Sektor targetSek = this.FieldField.get(newSek.objSektorKoord); readyCmd.TargetSektor = targetSek; this.raiseOnNewCommand(readyCmd); } int intNewFieldsMoved = intFieldsMoved + newSek.intMoveCost; if (intNewFieldsMoved < m_Unit.intMovement) { createMoveCommandsForSektor(newSek, intNewFieldsMoved); } } } }
public List<ICommand> getTypeCommands() { List<ICommand> cmdlist = new List<ICommand>(); ICommand cmd; if (this.intMovement > 0) { cmd = new comMove(this); cmdlist.Add(cmd); } if (this.intResourceValue > 0) { cmd = new comDropResource(this, null); cmdlist.Add(cmd); if (this.blnCanSpawnUnits) { cmd = new comPlaceUnit(this); cmdlist.Add(cmd); } } if (this.intCreateValuePerRound > 0) { cmd = new comCreateResource(this); cmdlist.Add(cmd); } return cmdlist; }