//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; }
public clsMoveFactory(clsUnit u, Field FieldField) : base(FieldField) { //set Members m_Unit = u; //Init Stuff m_originSektor = FieldField.getSektorForUnit(u); m_listKnownMovements.Add(m_originSektor.strUniqueID); }
public void Execute() { clsUnit unitToPlace = new clsUnit(UnitTypeToPlace); unitToPlace.strOwnerID = Owner.Id; Owner.ListUnits.Add(unitToPlace); TargetSektor.addUnit(unitToPlace); // UnitId setzen damit Unit registriert werden kann this.UnitId = unitToPlace.Id; }
public clsCommandCollection Unit_getCommandsForUnit(clsUnit unit) { clsCommandCollection objCommands; objCommands = this.m_campaignEngine.getCommandsForUnit(unit, unitCollisionStack.Contains(this.Unit_getSektorForUnit(unit))); foreach (ICommand cmd in objCommands.listReadyCommands) { m_dictCommandCache.Add(cmd.CommandId, cmd); cmd.onControllerEvent += new delControllerEvent(Command_onControllerEvent); } return objCommands; }
public List<ICommand> getCommandsForUnit(clsUnit unit) { List <ICommand> lstCmds = this.m_campaignEngine.getCommandsForUnit(unit); foreach(ICommand cmd in lstCmds) m_dictCommandCache.Add(cmd.CommandId, cmd); return lstCmds; }
public void createNewUnitAndRegister(Player owner, clsUnitType newUnitType, Sektor targetSektor) { clsUnit newUnit = new clsUnit(newUnitType); newUnit.strOwnerID = owner.Id; owner.ListUnits.Add(newUnit); targetSektor.addUnit(newUnit); this.onTick += new delTick(newUnit.CampaignController_onTick); }
private void erzeugeCommandButtonsForUnit(clsUnit unit) { try { this.clearCommandButtons(); hoffset = 1; int offset = 1; foreach (ICommand aktCommand in Program.m_objCampaign.getCommandsForUnit(unit)) { this.addButton(aktCommand, ref offset, unit.strAktCommandInfo); offset += 1; } hoffset += 1; } catch (Exception ex) { throw ex; } }
public clsSektorFactoryBase(clsUnit Unit, Field FieldField) { this.m_Unit = Unit; this.m_FieldField = FieldField; this.m_DirectionVektors = m_FieldField.getDirectionVectors(); }
public UnitInfo getUnitInfo(clsUnit unit) { Sektor s = getSektorContainingUnit(unit); Player owner = getUnitOwner(unit); string sektorId = (s == null) ? "" : s.strUniqueID; string ownerId = (owner == null) ? "" : owner.Id.ToString(); UnitInfo uInfo = new UnitInfo(); uInfo.sektorId = sektorId; uInfo.unitId = unit.Id.ToString(); uInfo.playerId = ownerId; return uInfo; }
public Sektor getSektorContainingUnit(clsUnit u) { return FieldField.getSektorForUnit(u); }
public clsCommandCollection getCommandsForUnit(clsUnit objAktUnit, bool blnCollision) { clsCommandCollection objCommands = new clsCommandCollection(); objCommands.aktUnit = objAktUnit; // Unfertige Commands von der Unit - Enthalten zB keine Position-/Zielsektoren objCommands.listRawCommands = (!blnCollision ? objAktUnit.getTypeCommands() : new List<ICommand> { new comSolveKollision() }); objCommands.listReadyCommands = new List<ICommand>(); // Liste mit ausführbaren Commands - Enthalten zB explizite Position / Zielsektoren objCommands.onStatus += new Field.delStatus(General_onNewStatus); foreach (ICommand cmdRaw in objCommands.listRawCommands) { clsFactoryBase objCommandFactory = cmdRaw.getCommandFactory(objAktUnit, FieldField); if (objCommandFactory != null) { objCommandFactory.actingPlayer = getPlayerByID(objAktUnit.strOwnerID); objCommands.useFactory(objCommandFactory); } else { cmdRaw.CommandId = Guid.NewGuid().ToString(); objCommands.listReadyCommands.Add(cmdRaw); } } return objCommands; }
public clsCommandCollection getCommandsForUnit(clsUnit objAktUnit) { return getCommandsForUnit(objAktUnit, false); }
public clsUnit addUnit(Player owner, clsUnit newUnit, Sektor sektor) { newUnit.strOwnerID = owner.Id; owner.ListUnits.Add(newUnit); sektor.addUnit(newUnit); return newUnit; }
public override void Setup(clsUnit aktUnit, Action<ICommand, clsCommandCollection> _commandCallback) { m_aktUnit = aktUnit; m_objCommandCollection = Program.m_objCampaign.Unit_getCommandsForUnit(aktUnit); mCommandCallback = _commandCallback; Refresh(); }
public Sektor Unit_getSektorForUnit(clsUnit unit) { return CampaignEngine.FieldField.getSektorForUnit(unit); }
public Player getUnitOwner(clsUnit unit) { var owner = (from p in lisPlayers where p.Id == unit.strOwnerID select p).First(); return owner as Player; }
//, string strSpawnSektorKoord = "" --> zu dev zwecken internal clsUnit addUnit(string strPlayerID, int intUnitTypeID, string strSpawnSektorKoord = "") { Player objPlayer = getPlayerByID(strPlayerID); clsSektorKoordinaten objSpawSek = null; if (strSpawnSektorKoord != "") { string[] split = strSpawnSektorKoord.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); int x = Convert.ToInt32(split[0]); int y = Convert.ToInt32(split[1]); int z = Convert.ToInt32(split[2]); objSpawSek = new clsSektorKoordinaten(x, y, z); } else { objSpawSek = (objPlayer.unitspawnSektor != null ? objPlayer.unitspawnSektor.objSektorKoord : this.FieldField.nullSektorKoord); } //Ergibt eineindeutige UnitIDs clsUnit objUnit = null; Sektor s = FieldField.dicSektors[objSpawSek.uniqueIDstr()]; if (s.ListUnits.Count<clsUnit>((n => n.strOwnerID == strPlayerID)) > 0) { objUnit = s.ListUnits.First<clsUnit>(u => u.strOwnerID == strPlayerID); objUnit.addNewSubUnit(objPlayer, intUnitTypeID); } else { objUnit = new clsUnit(objPlayer, intUnitTypeID); objUnit.strOwnerID = strPlayerID; objUnit.cnt = this.getID(this.getPlayerByID(strPlayerID)); List<Player> lisP = null; if (objUnit.blnAlywaysVisible) { lisP = this.lisPlayers; } else { lisP = new List<Player> { this.getPlayerByID(strPlayerID) }; } foreach (Player p in lisP) { p.ListUnits.Add(objUnit); } this.FieldField.get(objSpawSek).addUnit(objUnit); } return objUnit; }
public clsFactoryBase getCommandFactory(clsUnit objUnit, Field FieldField) { return null; }
public abstract clsFactoryBase getCommandFactory(clsUnit objUnit, Field FieldField);