public override void LoadRules(IniFile.IniSection rules) { base.LoadRules(rules); Normalized = rules.ReadBool("Normalized"); Translucent = rules.ReadBool("Translucent"); IsTiberium = rules.ReadBool("IsTiberium"); IsMeteor = rules.ReadBool("IsMeteor"); Elasticity = rules.ReadFloat("Elasticity", 0.8f); MinAngularVelocity = rules.ReadFloat("MinAngularVelocity"); MaxAngularVelocity = rules.ReadFloat("MaxAngularVelocity", 0.174528f); Duration = rules.ReadInt("Duration", 30); MinZVel = rules.ReadFloat("MinZVel", 3.5f); MaxZVel = rules.ReadFloat("MaxZVel", 5f); MaxXYVel = rules.ReadFloat("MaxXYVel", 15f); Spawns = Get <VoxelAnimation>(rules.ReadString("Spawns")); SpawnCount = rules.ReadInt("SpawnCount"); ShareBodyData = rules.ReadBool("ShareBodyData"); ShareTurretData = rules.ReadBool("ShareTurretData"); ShareBarrelData = rules.ReadBool("ShareBarrelData"); VoxelIndex = rules.ReadInt("VoxelIndex"); StartSound = Get <Sound>(rules.ReadString("StartSound")); StopSound = Get <Sound>(rules.ReadString("StopSound")); BounceAnim = Get <Animation>(rules.ReadString("BounceAnim")); ExpireAnim = Get <Animation>(rules.ReadString("ExpireAnim")); TrailerAnim = Get <Animation>(rules.ReadString("TrailerAnim")); Damage = rules.ReadInt("Damage"); DamageRadius = rules.ReadInt("DamageRadius"); Warhead = Get <WarheadType>(rules.ReadString("Warhead")); AttachedSystem = Get <ParticleSystem>(rules.ReadString("AttachedSystem")); ShareSource = Get <TechnoType>(rules.ReadString("ShareSource")); }
public override void LoadRules(IniFile.IniSection rules) { base.LoadRules(rules); WeaponType = rules.ReadEnum <WeaponType>("WeaponType", null); Action = rules.ReadEnum <Action>("Action", Action.MultiMissile); IsPowered = rules.ReadBool("IsPowered", true); DisableableFromShell = rules.ReadBool("DisableableFromShell"); SidebarFlashTabFrames = rules.ReadInt("SidebarFlashTabFrames", -1); AIDefendAgainst = rules.ReadBool("AIDefendAgainst"); PreClick = rules.ReadBool("PreClick"); PostClick = rules.ReadBool("PostClick"); ShowTimer = rules.ReadBool("ShowTimer"); SpecialSound = Get <Sound>(rules.ReadString("SpecialSound")); StartSound = Get <Sound>(rules.ReadString("StartSound")); Range = rules.ReadFloat("Range", 0); LineMultiplier = rules.ReadInt("LineMultiplier", 0); Type = rules.ReadEnum <AbstractType>("Type", null); PreDependent = rules.ReadEnum <WeaponType>("PreDependent", null); AuxBuilding = Get <BuildingType>(rules.ReadString("AuxBuilding")); UseChargeDrain = rules.ReadBool("UseChargeDrain"); ManualControl = rules.ReadBool("ManualControl"); RechargeTime = rules.ReadFloat("RechargeTime", 5.0f); SidebarImage = rules.ReadString("SidebarImage", ""); }
private AnimDrawable LoadExtraImage(string extraImage, DrawProperties inheritProps) { string animSection = Art.ReadString(extraImage); if (animSection == "") { return(null); } IniFile.IniSection extraRules = OwnerCollection.Rules.GetOrCreateSection(animSection); IniFile.IniSection extraArt = OwnerCollection.Art.GetOrCreateSection(animSection); var anim = new AnimDrawable(extraRules, extraArt); anim.OwnerCollection = OwnerCollection; anim.LoadFromRules(); anim.NewTheater = this.NewTheater; if (extraArt.HasKey("YSortAdjust") || Art.HasKey(extraImage + "YSort") || extraArt.HasKey("ZAdjust") || Art.HasKey(extraImage + "ZAdjust")) { anim.Props.SortIndex = extraArt.ReadInt("YSortAdjust", Art.ReadInt(extraImage + "YSort")) - extraArt.ReadInt("ZAdjust", Art.ReadInt(extraImage + "ZAdjust")); } else { anim.Props.SortIndex = inheritProps.SortIndex; } if (Art.HasKey(extraImage + "X") || Art.HasKey(extraImage + "Y")) { anim.Props.Offset = this.Props.Offset + new Size(Art.ReadInt(extraImage + "X"), Art.ReadInt(extraImage + "Y")); } else { anim.Props.Offset = inheritProps.Offset; } anim.Props.ZAdjust = Art.ReadInt(extraImage + "ZAdjust"); anim.IsBuildingPart = true; anim.Shp = VFS.Open <ShpFile>(anim.GetFilename()); return(anim); }
private Drawable InitSimpleDrawable(IniFile.IniSection rulesSection, IniFile.IniSection artSection) { var drawable = new ShpDrawable(rulesSection, artSection); InitDrawableDefaults(drawable, artSection); drawable.LoadFromRules(); string shpFile = drawable.GetFilename(); drawable.Shp = VFS.Open <ShpFile>(shpFile); if (Type == CollectionType.Smudge) { drawable.Foundation = new Size(rulesSection.ReadInt("Width", 1), rulesSection.ReadInt("Height", 1)); } if (Type == CollectionType.Overlay) { LoadOverlayDrawable(drawable); } return(drawable); }
private static Trigger ReadIniTrigger(IniFile.IniSection sec, string workingDir) { if (sec == null) { return(null); } var ret = new Trigger { Offset = sec.ReadPoint("Position"), Size = sec.ReadSize("Size"), }; ret.Axis = sec.ReadInt("Axis"); ret.OffsetScale = 0.08f; if (sec.HasKey("File_Trigger", false)) { ret.ImagePath = System.IO.Path.Combine(workingDir, sec.ReadString("File_Trigger", "", false)); } ret.Z = -1; // default to behind controller return(ret); }
private static Trigger ReadIniTrigger(IniFile.IniSection sec, FileInfo pi) { if (sec == null) { return(null); } var ret = new Trigger { Offset = sec.ReadPoint("Position"), Size = sec.ReadSize("Size"), }; ret.Axis = sec.ReadInt("Axis"); ret.OffsetScale = 0.08f; if (sec.HasKey("File_Trigger", false)) { ret.Bitmap = (Bitmap)Image.FromFile(System.IO.Path.Combine(pi.DirectoryName, sec.ReadString("File_Trigger", "", false))); ret.Texture = TextureHelper.CreateTexture(ret.Bitmap); } ret.Z = -1; // default to behind controller return(ret); }