/// <summary> /// Constructs a weapon data struct for an element type. /// </summary> /// <param name="name">The name of this weapon.</param> /// <param name="metadata">The metadata object that this weapon data belongs to.</param> /// <param name="weaponType">The type of this weapon.</param> public WeaponData(string name, ScenarioMetadata metadata, WeaponTypeEnum weaponType) { if (name == null) { throw new ArgumentNullException("name"); } if (metadata == null) { throw new ArgumentNullException("metadata"); } this.name = name; this.displayedName = null; this.weaponType = new ConstValue <WeaponTypeEnum>(weaponType); this.cooldown = null; this.damage = null; this.damageType = null; this.increment = new ConstValue <int>(0); this.rangeMax = null; this.rangeMin = new ConstValue <int>(0); this.splashType = new ConstValue <SplashTypeEnum>(SplashTypeEnum.None); this.missiles = new List <MissileData>(); this.metadata = metadata; }
/// <summary> /// Constructs a new element type. /// </summary> /// <param name="name">The name of this element type.</param> /// <param name="metadata">Reference to the metadata object that this type belongs to.</param> public ScenarioElementType(string name, ScenarioMetadata metadata) { if (name == null) { throw new ArgumentNullException("name"); } if (metadata == null) { throw new ArgumentNullException("metadata"); } if (metadata.IsFinalized) { throw new InvalidOperationException("ScenarioMetadata already finalized!"); } this.id = -1; this.name = name; this.displayedName = null; this.hasOwner = false; this.shadowSpriteName = null; this.shadowSpriteIndex = -1; this.shadowOffset = RCNumVector.Undefined; this.metadata = metadata; this.spritePalette = null; this.hpIconPalette = null; this.animationPalette = null; this.relativeQuadCoordsInSight = null; this.placementConstraints = new List <EntityPlacementConstraint>(); this.requirements = new List <Requirement>(); this.standardWeapons = new List <WeaponData>(); this.customWeapons = new List <WeaponData>(); }
/// <summary> /// Constructs a new building type. /// </summary> /// <param name="name">The name of this building type.</param> /// <param name="metadata">The metadata object that this building type belongs to.</param> public BuildingType(string name, ScenarioMetadata metadata) : base(name, metadata) { this.unitTypes = new Dictionary <string, UnitType>(); this.addonTypes = new Dictionary <string, AddonType>(); this.upgradeTypes = new Dictionary <string, UpgradeType>(); this.suggestionProviders = new List <BuildingPlacementSuggestionProvider>(); }
/// <summary> /// Constructs a new upgrade type. /// </summary> /// <param name="name">The name of this upgrade type.</param> /// <param name="metadata">The metadata object that this upgrade type belongs to.</param> public UpgradeType(string name, ScenarioMetadata metadata) : base(name, metadata) { this.effects = new List <UpgradeEffectBase>(); this.previousLevel = null; this.nextLevel = null; this.researchedIn = null; this.previousLevelName = null; }
/// <summary>Constructs an animation palette.</summary> /// <param name="metadata">The metadata object that this sprite palette belongs to.</param> public AnimationPalette(ScenarioMetadata metadata) { if (metadata == null) { throw new ArgumentNullException("metadata"); } this.animations = new Dictionary <string, Animation>(); this.previewAnimations = new List <Animation>(); this.metadata = metadata; }
/// <summary> /// Constructs a new missile type. /// </summary> /// <param name="name">The name of this missile type.</param> /// <param name="metadata">The metadata object that this missile type belongs to.</param> public MissileType(string name, ScenarioMetadata metadata) : base(name, metadata) { this.launchAnimation = null; this.launchDelay = 0; this.flyingAnimation = null; this.trailAnimation = null; this.trailAnimationFrequency = 0; this.impactAnimation = null; }
/// <summary> /// Constructs an UpgradeEffectBase instance. /// </summary> /// <param name="targetTypeName">The name of the type on which the effect to be performed.</param> /// <param name="metadata">The metadata object that this effect belongs to.</param> protected UpgradeEffectBase(string targetTypeName, ScenarioMetadata metadata) { if (metadata == null) { throw new ArgumentNullException("metadata"); } if (targetTypeName == null) { throw new ArgumentNullException("targetTypeName"); } this.targetTypeName = targetTypeName; this.metadata = metadata; }
/// <summary> /// Constructs a requirement object. /// </summary> /// <param name="buildingTypeName">The name of the required building type.</param> /// <param name="addonTypeName"> /// The name of the required addon type or null if there is no addon type defined in this requirement. /// </param> /// <param name="metadata">The metadata object that this requirement belongs to.</param> public Requirement(string buildingTypeName, string addonTypeName, ScenarioMetadata metadata) { if (metadata == null) { throw new ArgumentNullException("metadata"); } if (buildingTypeName == null) { throw new ArgumentNullException("buildingTypeName"); } this.requiredBuildingTypeName = buildingTypeName; this.requiredAddonTypeName = addonTypeName; this.metadata = metadata; }
/// <summary> /// Constructs a MissileData instance. /// </summary> /// <param name="missileTypeName">The name of the corresponding missile type.</param> /// <param name="metadata"></param> public MissileData(string missileTypeName, ScenarioMetadata metadata) { if (missileTypeName == null) { throw new ArgumentNullException("missileTypeName"); } if (metadata == null) { throw new ArgumentNullException("metadata"); } this.missileType = null; this.missileTypeName = missileTypeName; this.metadata = metadata; this.relativeLaunchPositions = new Dictionary <MapDirection, RCNumVector>(); }
/// <summary> /// Constructs a new addon type. /// </summary> /// <param name="name">The name of this addon type.</param> /// <param name="metadata">The metadata object that this addon type belongs to.</param> public AddonType(string name, ScenarioMetadata metadata) : base(name, metadata) { this.upgradeTypes = new Dictionary <string, UpgradeType>(); this.mainBuilding = null; }
/// <summary> /// Constructs a new unit type. /// </summary> /// <param name="name">The name of this unit type.</param> /// <param name="metadata">The metadata object that this unit type belongs to.</param> public UnitType(string name, ScenarioMetadata metadata) : base(name, metadata) { this.necessaryAddon = null; this.createdIn = null; }
/// <summary> /// Constructs an upgrade effect that executes an action with a parameter. /// </summary> /// <param name="action">The action to be executed.</param> /// <param name="actionParam">The parameter of the action.</param> /// <param name="targetTypeName">The name of the type on which the effect to be performed.</param> /// <param name="metadata">The metadata object that this effect belongs to.</param> public UpgradeEffect(Action <IScenarioElementTypeUpgrade, T> action, T actionParam, string targetTypeName, ScenarioMetadata metadata) : base(targetTypeName, metadata) { if (action == null) { throw new ArgumentNullException("action"); } this.action = action; this.actionParam = actionParam; }
/// <summary> /// Creates an upgrade effect. /// </summary> /// <param name="actionName">The name of the action to be executed by the effect.</param> /// <param name="parameterStr">The parameter of the effect or null if the effect has no parameter.</param> /// <param name="targetType">The target type of the effect.</param> /// <param name="metadata">The metadata object.</param> /// <returns>The created effect.</returns> public static UpgradeEffectBase CreateUpgradeEffect(string actionName, string parameterStr, string targetType, ScenarioMetadata metadata) { if (!upgradeEffectFactoryMethods.ContainsKey(actionName)) { throw new ArgumentException(string.Format("Factory method for upgrade effect '{0}' not defined!", actionName)); } return(upgradeEffectFactoryMethods[actionName](parameterStr, targetType, metadata)); }