예제 #1
0
 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);
 }
예제 #2
0
파일: Parser_4_1.cs 프로젝트: wshanshan/DDD
        /// <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;
        }