コード例 #1
0
ファイル: IAddonType.cs プロジェクト: kovacsgabor55/marsara
 /// <summary>
 /// Constructs an instance of this interface with the given implementation.
 /// </summary>
 /// <param name="implementation">The implementation of this interface.</param>
 internal IAddonType(IAddonTypeInternal implementation) : base(implementation)
 {
     if (implementation == null)
     {
         throw new ArgumentNullException("implementation");
     }
     this.implementation = implementation;
 }
コード例 #2
0
        /// <see cref="IBuildingTypeInternal.GetRelativeAddonPosition"/>
        public RCIntVector GetRelativeAddonPosition(IMapAccess map, IAddonTypeInternal addonType)
        {
            if (map == null)
            {
                throw new ArgumentNullException("map");
            }
            if (addonType == null)
            {
                throw new ArgumentNullException("addonType");
            }
            if (!this.HasAddonType(addonType.Name))
            {
                throw new ArgumentException(string.Format("Building type '{0}' is not defined as the main building for addon type '{1}'!", this.Name, addonType.Name));
            }

            RCIntVector buildingQuadSize = map.CellToQuadSize(this.Area.Read().Size);
            int         addonQuadHeight  = map.CellToQuadSize(addonType.Area.Read().Size).Y;

            return(new RCIntVector(buildingQuadSize.X, buildingQuadSize.Y - addonQuadHeight));
        }
コード例 #3
0
        /// <see cref="IBuildingTypeInternal.CheckPlacementConstraints"/>
        public RCSet <RCIntVector> CheckPlacementConstraints(Scenario scenario, RCIntVector position, IAddonTypeInternal addonType, RCSet <Entity> entitiesToIgnore)
        {
            if (addonType == null)
            {
                throw new ArgumentNullException("addonType");
            }
            if (!this.HasAddonType(addonType.Name))
            {
                throw new ArgumentException(string.Format("Building type '{0}' is not defined as the main building for addon type '{1}'!", this.Name, addonType.Name));
            }

            RCSet <RCIntVector> retList = this.CheckPlacementConstraints(scenario, position, entitiesToIgnore);

            RCIntVector relativeAddonPos = this.GetRelativeAddonPosition(scenario.Map, addonType);
            RCIntVector addonPos         = position + relativeAddonPos;

            foreach (RCIntVector quadCoordViolatingByAddon in addonType.CheckPlacementConstraints(scenario, addonPos, entitiesToIgnore))
            {
                retList.Add(quadCoordViolatingByAddon + relativeAddonPos);
            }

            return(retList);
        }
コード例 #4
0
 /// <see cref="IBuildingTypeInternal.GetRelativeAddonPosition"/>
 RCIntVector IBuildingTypeInternal.GetRelativeAddonPosition(IMapAccess map, IAddonTypeInternal addonType)
 {
     return(this.originalBuildingType.GetRelativeAddonPosition(map, addonType));
 }
コード例 #5
0
 /// <see cref="IBuildingTypeInternal.CheckPlacementConstraints"/>
 RCSet <RCIntVector> IBuildingTypeInternal.CheckPlacementConstraints(Scenario scenario, RCIntVector position, IAddonTypeInternal addonType, RCSet <Entity> entitiesToIgnore)
 {
     return(this.originalBuildingType.CheckPlacementConstraints(scenario, position, addonType, entitiesToIgnore));
 }