Ejemplo n.º 1
0
        /// <summary>
        /// Creates an RCCommand from the state of this CommandBuilder.
        /// </summary>
        /// <returns>The created RCCommand.</returns>
        /// <exception cref="InvalidOperationException">If RCCommand could not be created.</exception>
        public RCCommand CreateCommand()
        {
            //if (this.commandType == null) { throw new InvalidOperationException("Undefined command type!"); }

            RCSet <int> recipientEntities = this.selectionManager.CurrentSelection;

            /// TODO: check if all the recipient entities belong to the local player!

            return(new RCCommand(this.commandType,
                                 recipientEntities.ToArray(),
                                 this.targetPosition,
                                 this.targetEntity,
                                 this.parameter));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Reattaches the underlying VespeneGeyser if it has not yet been reattached.
 /// </summary>
 private void ReattachUnderlyingVespeneGeyser()
 {
     if (this.underlyingVespeneGeyser.Read() != null)
     {
         if (this.MotionControl.Status == MotionControlStatusEnum.Fixed)
         {
             this.MotionControl.Unfix();
         }
         RCSet <Entity> entitiesToIgnore = this.Scenario.GetElementsOnMap <Entity>(this.Area, MapObjectLayerEnum.GroundObjects);
         entitiesToIgnore.Add(this);
         if (!this.underlyingVespeneGeyser.Read().AttachToMap(this.MotionControl.PositionVector.Read(), entitiesToIgnore.ToArray()))
         {
             throw new InvalidOperationException("Underlying VespeneGeyser could not be reattached!");
         }
         this.underlyingVespeneGeyser.Write(null);
     }
 }