public BearingWall(string Id, Line2D wallLine, BuildingLevel level) { UniqueId = Id; EndI = new Point3D(wallLine.StartPoint.X, wallLine.StartPoint.Y, level.Elevation); EndJ = new Point3D(wallLine.EndPoint.X, wallLine.EndPoint.Y, level.Elevation); TopLevel = level; }
private static List <PointDrift> DisplacementsWithUnknownDrifts(BuildingLevel level, IEnumerable <NodalResponse> nodalResponses) { var drifts = new List <PointDrift>(); foreach (NodalResponse response in nodalResponses) { drifts.Add(new PointDrift { Name = response.ElementId, Coordinate = response.Coordinate, Level = level, LoadCategory = response.LoadCase.LoadPatternType, Displacement = new Length(response.Displacement.Ux, LengthUnit.Inch), Direction = LateralDirection.X, LoadCase = response.LoadCase }); drifts.Add(new PointDrift { Name = response.ElementId, Coordinate = response.Coordinate, Level = level, LoadCategory = response.LoadCase.LoadPatternType, Displacement = new Length(response.Displacement.Uy, LengthUnit.Inch), Direction = LateralDirection.Y, LoadCase = response.LoadCase }); } return(drifts); }
//-------------------------------------------------- public PlayerLevel(Vector3 cell_size, int map_width, int map_lenght, GridMap playerlevel) { buildinglevel = new BuildingLevel(); buildinglevel.init(cell_size, map_width, map_lenght, playerlevel); unitlevel = new UnitLevel(cell_size); setConnectionsBetweenLevels(); }
private void DispatchActor(BuildingController entityType, BuildingLevel buildingLevel) { ActorsManager.GetInstance() .CreateNewActor( entityType.Building.FactionType, entityType.Building.Race, buildingLevel == BuildingLevel.BuildingLevel1 ? entityType.Building.ProducedActorTypeLevel1 : entityType.Building.ProducedActorTypeLevel2, entityType.MyTransform.position); }
public SlotViewModel(Province province, Region region, BuildingSlot slot) { this.slot = slot; this.region = region; this.province = province; this.Buildings = new ObservableCollection <BuildingLevel>(); this.selectedBuilding = slot.Building; this.seek = false; }
private static List <BuildingLevel> DBDetail(string _DBName) { if (SystemInfo.deviceType == DeviceType.Desktop) // PC { string fullFileName = String.Format(@"Assets\Resources\" + m_FilePath + ".txt", _DBName); using (StreamReader sr = new StreamReader(new FileStream(fullFileName, FileMode.Open))) { sr.ReadLine(); List <BuildingLevel> infoList = new List <BuildingLevel>(); while (sr.EndOfStream == false) { string[] arr = sr.ReadLine().Split(new char[] { '\t' }, StringSplitOptions.None); BuildingLevel info = new BuildingLevel(); info.Level = Convert.ToInt32(arr[0]); info.NextPrice = Convert.ToInt32(arr[1]); infoList.Add(info); } sr.Close(); return(infoList); } } else if (SystemInfo.deviceType == DeviceType.Handheld) // SmartPhone, Tablet { TextAsset asset = Resources.Load(String.Format(m_FilePath, _DBName)) as TextAsset; if (asset != null) { string assetContent = asset.text; List <BuildingLevel> infoList = new List <BuildingLevel>(); string[] contentArr = assetContent.Split(new string[] { "\r\n" }, StringSplitOptions.None); for (int i = 1; i < contentArr.Length; i++) { string[] arr = contentArr[i].Split(new char[] { '\t' }, StringSplitOptions.None); BuildingLevel info = new BuildingLevel(); info.Level = Convert.ToInt32(arr[0]); info.NextPrice = Convert.ToInt32(arr[1]); infoList.Add(info); } return(infoList); } } return(null); }
public void Analyze_Breyer6thEd_16_11_Succeeds() { var sB = new StringBuilder(); var level = new BuildingLevel("Level 2", 100); var lateralWalls = new List <AnalyticalWallLateral>(); lateralWalls.Add(new AnalyticalWallLateral("Wall A", new Point2D(0, 0), new Point2D(0, 240), level)); lateralWalls.Add(new AnalyticalWallLateral("Wall B", new Point2D(360, 0), new Point2D(360, 240), level)); lateralWalls.Add(new AnalyticalWallLateral("Wall C-1", new Point2D(0, 0), new Point2D(60, 0), level)); lateralWalls.Add(new AnalyticalWallLateral("Wall C-2", new Point2D(300, 0), new Point2D(360, 0), level)); lateralWalls.Add(new AnalyticalWallLateral("Wall D", new Point2D(0, 240), new Point2D(360, 240), level)); var deck = new OneWayDeck { Level = level, Boundary = new Polygon2D(new List <Point2D> { new Point2D(0, 0), new Point2D(0, 240), new Point2D(360, 240), new Point2D(360, 0) }), WeightPerArea = new Stress(40, StressUnit.psf) }; var lateralLevel = new BuildingLevelLateral2(deck); var forces = new List <LateralLevelForce> { new LateralLevelForce { DirectX = new Force(-6000, ForceUnit.Pound), LoadPattern = LoadPattern.Seismic_West, CenterOfForce = new Point2D(180, 120) }, new LateralLevelForce { AccidentalT = new Moment(6, MomentUnit.KipFoot), LoadPattern = LoadPattern.SeismicTorsion_XLoading, CenterOfForce = new Point2D(180, 120) } }; var loadCases = new List <LoadCase> { CommonResources.ASCE7LoadCases["-X - TX"], }; var analysis = new RigidAnalysis(lateralLevel, lateralWalls, forces, loadCases, 1); analysis.Analyze(); var table = RigidAnalysisTabularReport.GenerateShearWallForceStiffnessTable(analysis); sB.Append(table.PrintToMarkdown()); }
public SerializedModel(double buildingHeight, int numberOfStories, Seismicity seismicity, List <Line2D> wallLines, List <Line2D> corridorLines, Polygon2D outline, List <Polygon2D> unitBoundaries, RandomizedBuilding randomizedBuilding, double randomizedPercent) { var levels = new List <BuildingLevel>(); for (int i = 1; i <= numberOfStories; i++) { levels.Add(new BuildingLevel("LEVEL_" + i, buildingHeight * i)); } ModelSettings = new ModelSettings(buildingHeight); var systemParameters = new SystemParameters(); var seismicBaseLevel = new BuildingLevel("BASE", 0); var buildingParameters = new BuildingParameters(seismicBaseLevel); SeismicParameters = new SeismicParameters(systemParameters, buildingParameters, seismicity); var bearingWalls = new List <BearingWall>(); var oneWayDecks = new List <OneWayDeck>(); Random random = new Random(); int test = random.Next(0, 2); foreach (var level in levels) { var wallLineID = 1; foreach (var wallLine in wallLines) { if (random.NextDouble() < randomizedPercent) { var wallId = level.Name + "_" + wallLineID; bearingWalls.Add(new BearingWall(wallId, wallLine, level)); wallLineID += 1; } } foreach (var wallLine in corridorLines) { var wallId = level.Name + "_" + wallLineID; bearingWalls.Add(new BearingWall(wallId, wallLine, level)); wallLineID += 1; } oneWayDecks.Add(new OneWayDeck(outline, level)); } OneWayDecks = oneWayDecks; UnitBoundaries = unitBoundaries; }
protected void Init() { hp = 10; int random_level = Random.Range(0, (int)BuildingLevel.NONE); int random_type = Random.Range(0, (int)BuildingType.NONE); building_level = (BuildingLevel)random_level; building_type = (BuildingType)random_type; status = BuildingStatus.BUILD; sprite_render = gameObject.GetComponent <SpriteRenderer>(); }
public static LevelDictionary <PointDrift> GetDesignBoundaryCornerDrifts(LevelDataDictionary <RigidAnalysis> analyses) { var drifts = new LevelDictionary <PointDrift>(); List <BuildingLevelLateral2> sortedLevels = analyses.Select(l => l.Value.LateralLevel).OrderBy(l => l.Level.Elevation).ToList(); for (var i = 0; i < sortedLevels.Count; i++) { BuildingLevel level = sortedLevels[i].Level; RigidAnalysis analysis = analyses[level]; List <PointDrift> driftsAtLevel = DisplacementsWithUnknownDrifts(level, analysis.Responses.NodalLoadCaseResults.Values.SelectMany(r => r)); var storyHeight = sortedLevels[i].Height; if (i == 0) { // Lowest level; compare to ground driftsAtLevel.ForEach(d => { d.Drift = (Unitless)Result.Abs(d.Displacement / storyHeight); d.CoordinateBelow = d.Coordinate; d.DisplacementBelow = new Length(0, LengthUnit.Inch); }); } else { // Elevated level; compare to level below List <PointDrift> driftsAtLevelBelow = drifts[sortedLevels[i - 1].Level]; driftsAtLevel.ForEach(d => { PointDrift driftBelow = d.GetMatchingDriftAtLevelBelow(driftsAtLevelBelow); d.Drift = (Unitless)Result.Abs((d.Displacement - driftBelow.Displacement) / storyHeight); d.CoordinateBelow = driftBelow.Coordinate; d.DisplacementBelow = driftBelow.Displacement; }); } drifts.Add(level, driftsAtLevel); } return(drifts); }
private static void DisplayLevel(DatabaseContext context, BuildingLevel level, int depth) { Console.Write(new string(' ', depth * 2)); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("{0}", level.Name); Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write(" (Id: {0})", level.Id); Console.WriteLine(); var children = context.BuildingLevels.Where(x => x.ParentBuildingLevelId == level.Id).ToList(); foreach (var child in children) { DisplayLevel(context, child, depth + 1); } }
public void Setup(BuildingLevel buildingLevel) { oldProduction.text = "" + buildingLevel.ressourceGenTransaction.delta; oldCapacity.text = "" + buildingLevel.ressourceGenTransaction.ressourceType.maxValueReference.Value; oldProductionIcon.sprite = buildingLevel.ressourceGenTransaction.ressourceType.icon; oldCapacityIcon.sprite = buildingLevel.ressourceGenTransaction.ressourceType.icon; newProductionIcon.sprite = buildingLevel.nextLevel.ressourceGenTransaction.ressourceType.icon; newCapacityIcon.sprite = buildingLevel.ressourceGenTransaction.ressourceType.icon; if (!buildingLevel.isLastLevel) { goldCost.text = "" + buildingLevel.upgradeCosts[0].delta; stoneCost.text = "" + buildingLevel.upgradeCosts[1].delta; woodCost.text = "" + buildingLevel.upgradeCosts[2].delta; newProduction.text = "" + buildingLevel.nextLevel.ressourceGenTransaction.delta; newCapacity.text = "" + (buildingLevel.ressourceGenTransaction.ressourceType.maxValueReference.Value + buildingLevel.maxStorageIncrement); } else { goldCost.text = "---"; stoneCost.text = "---"; woodCost.text = "---"; newProduction.text = "---"; newCapacity.text = "---"; } upgradeButton.interactable = behavior.canLevelUp(); upgradeButton.onClick.AddListener(delegate { behavior.LevelUp(); gameObject.GetComponentInParent <BuildingBehaviour>().gameObject.GetComponentInChildren <InteractableBuilding>().currentLevel = behavior.currentLevel; HideForm(); }); cancelButton.onClick.AddListener(delegate { HideForm(); }); hasBeenSetup = true; }
public bool LevelUp() { if (currentLevel.nextLevel != null && canLevelUp()) { List <RessourceTransaction> levelUpCosts = currentLevel.upgradeCosts; foreach (var cost in levelUpCosts) { ModifyRessource(cost.ressourceType, cost.delta); } currentLevel.ressourceGenTransaction.ressourceType.maxValueReference.Value += currentLevel.maxStorageIncrement; currentLevel = currentLevel.nextLevel; buildingUpgratedEvent.Raise(); return(true); } return(false); }
static void CriaLeveis() { DataBase.Executar <Building>((db, col) => { db.Shrink(); col.FindAll() .ForEach(build => { //var leveis = // db.GetCollection<BuildingLevel>() // .FindAll() // .Where(a => a.Building.Id == build.Id) // .ToList(); for (var i = 1; i <= 35; i++) { if (db.GetCollection <BuildingLevel>().Exists(a => a.Building.Id == build.Id && a.Level == i)) { continue; } var level = new BuildingLevel { Building = build, Level = i }; db.GetCollection <BuildingLevel>() .Insert(level); build.Levels.Add(level); } col.Update(build); }); }); }
public void SingleStory_E2E_Succeeds() { var level = new BuildingLevel("Level 02", 100); var serializedModel = new SerializedModel { BearingWalls = new List <BearingWall> { new BearingWall { TopLevel = level, EndI = new Point3D(0, 0, 100), EndJ = new Point3D(0, 240, 100), UniqueId = "Wall A", HasOpening = false, IsShearWall = true }, new BearingWall { TopLevel = level, EndI = new Point3D(360, 0, 100), EndJ = new Point3D(360, 240, 100), UniqueId = "Wall B", HasOpening = false, IsShearWall = true }, new BearingWall { TopLevel = level, EndI = new Point3D(0, 0, 100), EndJ = new Point3D(60, 0, 100), UniqueId = "Wall C-1", HasOpening = false, IsShearWall = true }, new BearingWall { TopLevel = level, EndI = new Point3D(300, 0, 100), EndJ = new Point3D(360, 0, 100), UniqueId = "Wall C-2", HasOpening = false, IsShearWall = true }, new BearingWall { TopLevel = level, EndI = new Point3D(0, 240, 100), EndJ = new Point3D(360, 240, 100), UniqueId = "Wall D", HasOpening = false, IsShearWall = true } }, OneWayDecks = new List <OneWayDeck> { new OneWayDeck() { Level = level, Boundary = new Polygon2D(new List <Point2D> { new Point2D(0, 0), new Point2D(0, 240), new Point2D(360, 240), new Point2D(360, 0) }), WeightPerArea = new Stress(40, StressUnit.psf) } }, ModelSettings = new ModelSettings { BuildingHeight = level.Elevation }, SeismicParameters = new SeismicParameters { BuildingParameters = new BuildingParameters() { ImportanceFactor = 1.0, SeismicBaseLevel = new BuildingLevel("Level 01", 0) }, Seismicity = Seismicity.High, SystemParameters = new SystemParameters { Cd = 4, R = 6.5, Omega = 3, Ct = 0.02, X = 0.75 } }, RandomizedBuilding = Randomize.Random() }; var manager = new AnalysisManager(serializedModel); var wallCosts = manager.Run(); var table = RigidAnalysisTabularReport.GenerateShearWallForceStiffnessTable(manager.RigidAnalyses[level]); var output = table.PrintToMarkdown(); string executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string fpath = Path.Combine(executingPath, @"DataOutput\testData.csv"); wallCosts.WriteToCSV(fpath); }
// Assumes that the centers of mass stack vertically, so we can apply the design story shear directly public List <LateralLevelForce> GenerateAppliedLoadingAtLevel(BuildingLevelLateral2 lateralLevel) { var loads = new List <LateralLevelForce>(); BuildingLevel level = lateralLevel.Level; Point2D CenterOfMass = lateralLevel.CenterOfMass; SeismicStoryForce storyShears = _storyShears[level]; // Calculate direct seismic forces loads.Add(new LateralLevelForce { Level = level, DirectX = storyShears.X, LoadPattern = LoadPattern.Seismic_East, CenterOfForce = CenterOfMass }); loads.Add(new LateralLevelForce { Level = level, DirectX = (Force)(-storyShears.X), LoadPattern = LoadPattern.Seismic_West, CenterOfForce = CenterOfMass }); loads.Add(new LateralLevelForce { Level = level, DirectY = storyShears.Y, LoadPattern = LoadPattern.Seismic_North, CenterOfForce = CenterOfMass }); loads.Add(new LateralLevelForce { Level = level, DirectY = (Force)(-storyShears.Y), LoadPattern = LoadPattern.Seismic_South, CenterOfForce = CenterOfMass }); // Calculate accidental seismic forces Length lengthX = lateralLevel.LengthX; Length lengthY = lateralLevel.LengthY; AccidentalEccentricities eccentricities = lateralLevel.Eccentricities; loads.Add(new LateralLevelForce { Level = level, AccidentalT = (Moment)Result.Abs(eccentricities.SeismicX * lengthY * storyShears.X), LoadPattern = LoadPattern.SeismicTorsion_XLoading, CenterOfForce = CenterOfMass }); loads.Add(new LateralLevelForce { Level = level, AccidentalT = (Moment)Result.Abs(eccentricities.SeismicY * lengthX * storyShears.Y), LoadPattern = LoadPattern.SeismicTorsion_YLoading, CenterOfForce = CenterOfMass }); return(loads); }
public BuildingParameters(BuildingLevel seismicBaseLevel) { SeismicBaseLevel = seismicBaseLevel; }
public OneWayDeck(Polygon2D boundary, BuildingLevel level) { }
public AnalyticalWallLateral(string id, Point2D endI, Point2D endJ, BuildingLevel topLevel) { WallLine = new LineSegment2D(endI, endJ); UniqueId = id; TopLevel = topLevel; }
public LevelHeightResolver(IEnumerable <BuildingLevelLateral2> levels, BuildingLevel baseLevel) { _levels = levels.ToList(); _baseLevel = baseLevel; }
//-------------------------------------------------- public void setBuildingLevel(BuildingLevel buildinglevel) { this.buildinglevel = buildinglevel; }
public static int GetProducedTime(RaceType raceType, BuildingType buildingType, BuildingLevel buildingLevel) { if (raceType == RaceType.Terran) { switch (buildingType) { case BuildingType.Terran_Barrack: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingBarrackConfig.ProducedTimeLevel1 : TerranBuildingBarrackConfig.ProducedTimeLevel2); case BuildingType.Terran_SniperHouse: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingSniperHouseConfig.ProducedTimeLevel1 : TerranBuildingSniperHouseConfig.ProducedTimeLevel2); case BuildingType.Terran_ArtilleryLab: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingArtilleryLabConfig.ProducedTimeLevel1 : TerranBuildingArtilleryLabConfig.ProducedTimeLevel2); case BuildingType.Terran_MysterySchool: return(TerranBuildingMysterySchoolConfig.ProducedTimeLevel1); case BuildingType.Terran_Aviary: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingAviaryConfig.ProducedTimeLevel1 : TerranBuildingAviaryConfig.ProducedTimeLevel2); case BuildingType.Terran_Fortress: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingFortressConfig.ProducedTimeLevel1 : TerranBuildingFortressConfig.ProducedTimeLevel2); case BuildingType.Terran_Church: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingChurchConfig.ProducedTimeLevel1 : TerranBuildingChurchConfig.ProducedTimeLevel2); case BuildingType.Terran_Temple: return(buildingLevel == BuildingLevel.BuildingLevel1 ? TerranBuildingTempleConfig.ProducedTimeLevel1 : TerranBuildingTempleConfig.ProducedTimeLevel2); } } else if (raceType == RaceType.Orc) { switch (buildingType) { case BuildingType.Orc_AnimalFarm: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingAnimalFarmConfig.ProducedTimeLevel1 : OrcBuildingAnimalFarmConfig.ProducedTimeLevel2); case BuildingType.Orc_OrcFactory: return(OrcBuildingOrcFactoryConfig.ProducedTimeLevel1); case BuildingType.Orc_ShamanTent: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingShamanTentConfig.ProducedTimeLevel1 : OrcBuildingShamanTentConfig.ProducedTimeLevel2); case BuildingType.Orc_ThePound: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingThePoundConfig.ProducedTimeLevel1 : OrcBuildingThePoundConfig.ProducedTimeLevel2); case BuildingType.Orc_TheTaurenVine: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingTheTaurenVineConfig.ProducedTimeLevel1 : OrcBuildingTheTaurenVineConfig.ProducedTimeLevel2); case BuildingType.Orc_TrollHouse: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingTrollHouseConfig.ProducedTimeLevel1 : OrcBuildingTrollHouseConfig.ProducedTimeLevel2); case BuildingType.Orc_WarriorHall: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingWarriorHallConfig.ProducedTimeLevel1 : OrcBuildingWarriorHallConfig.ProducedTimeLevel2); case BuildingType.Orc_WyvernCamp: return(buildingLevel == BuildingLevel.BuildingLevel1 ? OrcBuildingWyvernCampConfig.ProducedTimeLevel1 : OrcBuildingWyvernCampConfig.ProducedTimeLevel2); } } return(0); }
public PointLoad(Point2D location, double magnitude, BuildingLevel level, Projection projection, LoadPattern loadPattern) : base(level, projection, loadPattern) { Location = location; Magnitude = magnitude; }
public FloorLoad(BuildingLevel level, Projection projection, LoadPattern loadPattern) { Level = level; Projection = projection; LoadPattern = loadPattern; }