Exemple #1
0
        public Move_EventType(pMoveType mEvent)
            : base(mEvent.UnitID,
            mEvent.Timer)
        {

            this.destination = new LocationType(mEvent.Location.X, mEvent.Location.Y,
          mEvent.Location.Z);

            this.throttle = mEvent.Throttle;
            if (null != mEvent.EngramRange)
            {
                this.Range = new EngramRange(mEvent.EngramRange);
            }
        }
Exemple #2
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;
        }