public pMoveType(string unitID, pEngramRange engramRange, int timer, pLocationType location, double throttle) { this.engramRange = engramRange; this.unitID = unitID; this.timer = timer; this.throttle = throttle; this.location = location; randomInterval = new pRandomIntervalType(0, 0); }
/// <summary> /// Reads/returns a Move Event directive from the input /// </summary> public override pMoveType pGetMove() { string unitID = "Unknown object"; pMoveType mEvent; pRandomIntervalType ri = new pRandomIntervalType(0, 0); try { reader.Read(); unitID = pGetString(); pEngramRange engramRange = null; if ("EngramRange" == reader.Name) { engramRange = pGetEngramRange(); } int timer = pGetTime(); if ("RandomInterval" == reader.Name) { ri = pGetRandomInterval(); } double throttle = 100.0; if ("Throttle" == reader.Name) { throttle = (pGetInt() + 0.0) / 100; } pLocationType destination = pGetLocation(); mEvent = new pMoveType(unitID, engramRange, timer, destination, throttle); mEvent.RandomInterval = ri; reader.ReadEndElement(); } catch (System.Exception e) { throw new ApplicationException("Error reading Move command for " + unitID + ": ", e); } return mEvent; }