protected byte LeakPercent; // The percentage of gas on the tile that will be leaked into space. Behind the scenes, the gas is deleted. /// <summary> /// Does things relating to turfs, make sure this is called last in your Initalise() method. /// </summary> protected void InitaliseTurf() { IsDragable = false; // Sets all the properties tipical of a floor. IsPassable = true; IsTransparent = true; OtherProperties.Add("flat"); // Some of the things a turf would normally be. OtherProperties.Add("footheight"); InitaliseBace(); // Initalises the bace class. // TODO: Set up nesasary code to simulate an atmosphere. }
/// <summary> /// Initalsies the tile, always run this, or this tile wont exist. /// </summary> public void Initalise() { LeakPercent = 100; // It is space, so it leaks 100% of the air there. Seed = ObjectName.GetHashCode(); // This will get a random seed that isn't dependant on the system time as much since it is dependant on 1 centeral RNG (Right now. This will change.) Random Random = new Random(Seed); SpriteNumber = Random.Next(NumberOfSprites); // Choses what icon is used for this tile. SpriteState.Sprite = "Space" + SpriteNumber.ToString(); // Sets the sprite to that icon. ContentLoader.AddTexture("Space" + SpriteNumber, "Objects/Turf/Space/" + SpriteNumber); ZeroToThree = Random.Next(4); SpriteState.Rotation = ZeroToThree * (float)1.57079633; // Creates 4 varations of each sprite by rotating them, reducing common patterns. OtherProperties.Remove("footheight"); OtherProperties.Add("lackofobject"); // lackofobject means that the object in question is more of the lack of an object than an object itself. InitaliseTurf(); // Does things relating to turfs. Like makes you able to walk on them and see through them. }
public async Task <IActionResult> Create([Bind("PropertyId,Name,Description,Price,Price_sqm,Living_area,Land_area,Bathrooms,Bedrooms,Parking,Public_date,Update_date,TypePropertyId,ProjectId,StationId,ApplicationUserId")] Properties properties, string[] selectedFacilities, string[] selectedInteriors, string[] selectedFixtures, string[] selectedCommonArea, string[] selectedExtra, string[] selectedOther, string[] selectedBasic) { ClaimsPrincipal currentUser = this.User; var currentUserID = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; properties.ApplicationUserId = currentUserID; properties.Public_date = DateTime.Now; properties.Update_date = DateTime.Now; if (selectedFacilities != null) { properties.FacilitiesProperties = new List <FacilitiesProperty>(); foreach (var item in selectedFacilities) { var facilitiesToAdd = new FacilitiesProperty { PropertyId = properties.PropertyId, FacilitiesId = int.Parse(item) }; properties.FacilitiesProperties.Add(facilitiesToAdd); } } if (selectedInteriors != null) { properties.InteriorProperties = new List <InteriorProperties>(); foreach (var item in selectedInteriors) { var interiorsToAdd = new InteriorProperties { PropertiesId = properties.PropertyId, InteriorId = int.Parse(item) }; properties.InteriorProperties.Add(interiorsToAdd); } } if (selectedFixtures != null) { properties.FixturesProperties = new List <FixturesProperty>(); foreach (var item in selectedFixtures) { var fixturesToAdd = new FixturesProperty { PropertiesId = properties.PropertyId, FixturesId = int.Parse(item) }; properties.FixturesProperties.Add(fixturesToAdd); } } if (selectedCommonArea != null) { properties.CommonAreaProperties = new List <CommonAreaProperties>(); foreach (var item in selectedCommonArea) { var commonAreaToAdd = new CommonAreaProperties { PropertiesId = properties.PropertyId, CommonAreaId = int.Parse(item) }; properties.CommonAreaProperties.Add(commonAreaToAdd); } } if (selectedExtra != null) { properties.ExtraProperies = new List <ExtraProperies>(); foreach (var item in selectedExtra) { var extraToAdd = new ExtraProperies { PropertiesId = properties.PropertyId, ExtraId = int.Parse(item) }; properties.ExtraProperies.Add(extraToAdd); } } if (selectedOther != null) { properties.OtherProperties = new List <OtherProperties>(); foreach (var item in selectedOther) { var otherToAdd = new OtherProperties { PropertiesId = properties.PropertyId, OtherId = int.Parse(item) }; properties.OtherProperties.Add(otherToAdd); } } if (selectedBasic != null) { properties.BasicProperties = new List <BasicProperties>(); foreach (var item in selectedBasic) { var basicToAdd = new BasicProperties { PropertiesId = properties.PropertyId, BasicId = int.Parse(item) }; properties.BasicProperties.Add(basicToAdd); } } if (ModelState.IsValid) { _context.Add(properties); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } FacilitiesData(properties); InteriorsData(properties); FixturesData(properties); ExtraData(properties); OtherData(properties); CommonAreaData(properties); BasicData(properties); ViewData["ProjectId"] = new SelectList(_context.Projects, "ProjectId", "ProjectId", properties.ProjectId); ViewData["StationId"] = new SelectList(_context.Stations, "StationId", "StationId", properties.StationId); ViewData["TypePropertyId"] = new SelectList(_context.TypeProperties, "TypePropertyId", "TypePropertyId", properties.TypePropertyId); return(View(properties)); }