public async Task <bool> UpdateShuttle(Shuttle inputShuttle) { _dataContext.Shuttles.Update(inputShuttle); await _dataContext.SaveChangesAsync(); return(true); }
static void Main(string[] args) { var station = new Station(); var shuttle = new Shuttle(1, "Columbia"); IRule dockingRule = new DockingRule(shuttle); ICommand dock = new Dock(station, shuttle, dockingRule); var controller = new StationController(); controller.ExecuteCommand(dock, DockingSuccessful, DockingFailed); var shuttle2 = new Shuttle(2, "Discovery"); dockingRule = new DockingRule(shuttle2); dock = new Dock(station, shuttle2, dockingRule); controller.ExecuteCommand(dock, DockingSuccessful, DockingFailed); var shuttle3 = new Shuttle(3, "Challenger"); dockingRule = new DockingRule(shuttle3); dock = new Dock(station, shuttle3, dockingRule); controller.ExecuteCommand(dock, DockingSuccessful, DockingFailed); var undock = new Undock(station, shuttle2); controller.ExecuteCommand(undock, Undocked, (result) => { }); controller.ExecuteCommand(dock, DockingSuccessful, DockingFailed); }
public async void SearchShuttle_Ok() { //Arrange var shuttle = new Shuttle { Id = Guid.NewGuid(), Name = "Test" }; m_repositoryMock.Setup(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <IFilter <Shuttle> >())) .ReturnsAsync(new Tuple <int, List <Shuttle> >(1, new List <Shuttle> { shuttle })); //Act var(count, shuttles) = await m_shuttleService.SearchShuttleAsync(new Pagination(), new Ordering(), new ShuttleFilter { SearchTerm = shuttle.Id.ToString() }); //Assert m_repositoryMock.Verify(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <ShuttleFilter>()), Times.Once); Assert.Equal(1, count); Assert.Equal(shuttle, shuttles.First()); }
private static void CreateChargeTasks(MachinesDTO communicationMachine, Shuttle shuttle) { var asrs = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_OUT); var taskBatch = machineTasksData.GetNewTaskBatch(); var chrgAddress = addressData.GetAvailableChargeAddress(); MachineTask opt1 = new MachineTask //asrs shuttle taşıma { OrderDetailPalletId = 0, ProductNotificationId = 0, TaskType = (int)TaskType.ShCHRG, TaskBatch = taskBatch, Sequence = 1, MachineCode = asrs.Code, SourceType = AddressType.ADDRESS, SourceAddress = shuttle.LastAddress, LoadInfo = shuttle.Code, TargetType = AddressType.ADDRESS, TargetAddress = chrgAddress, AssignUser = "******", AssignReason = "Charge", AssignTime = DateTime.Now, StartTime = null, EndTime = null, SentFlag = false, IsCompleted = false, ErrorCode = null }; machineTasksData.InsertMachineTaskBatch(new List <MachineTask> { opt1 }); }
public async void UpdateWithValidData_Ok() { //Arrange var explorersTeam = new ExplorersTeam { Id = Guid.NewGuid(), Name = "Test" }; var shuttle = new Shuttle { Id = Guid.NewGuid(), Name = "Test", ExplorersTeamId = explorersTeam.Id, ShipNumber = "A1" }; m_repositoryMock.Setup(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <IFilter <Shuttle> >())) .ReturnsAsync(new Tuple <int, List <Shuttle> >(1, new List <Shuttle> { shuttle })); m_explorersTeamRepositoryMock.Setup(t => t.SearchAsync(It.IsAny <Pagination>(), It.IsAny <Ordering>(), It.IsAny <ExplorersTeamFilter>())) .ReturnsAsync(new Tuple <int, List <ExplorersTeam> >(1, new List <ExplorersTeam> { explorersTeam })); //Act await m_shuttleService.UpdateShuttleAsync(shuttle); //Assert m_repositoryMock.Verify(t => t.UpdateAsync(It.IsAny <List <Shuttle> >()), Times.Once); }
public void InitLevel() { rocketNewPart = Resources.Load <AudioClip>("SFX/RocketSounds/RocketNewPart"); rocketFinished = Resources.Load <AudioClip>("SFX/RocketSounds/RocketFinished"); //canvas.gameObject.SetActive(false); //TODO first called in Start menu, then after each planet is won //Called whenever a new Planet is visited //reset planet variables //TODO reset destruction levels //canvas.SetActive(false); shuttle = Instantiate(shuttlePrefab).GetComponent <Shuttle>(); //todo set pickups/time based on level currentPickups = 0; for (int i = 0; i < 3; i++) { AddPlanet(); } //reset timer timer = 0.0f; totalTime = 0.0f; gamestate = State.Pickup; //todo spawn players ActivateNextPlanet(); SelectCrashPoint(activePlanet); InitActivePlanet(); }
public MultiShuttleElevator(MultiShuttleElevatorInfo info) : base(info) { multishuttleinfo = info; Embedded = true; ParentMultiShuttle = info.Multishuttle; //ElevatorConveyor = new StraightTransportSection(Color.Gray, info.multishuttleinfo.ElevatorConveyorLength, info.multishuttleinfo.ElevatorConveyorWidth); ElevatorConveyor = new ElevatorConveyor(new ElevatorConveyorInfo { length = info.multishuttleinfo.ElevatorConveyorLength, width = info.multishuttleinfo.ElevatorConveyorWidth, thickness = 0.05f, color = Core.Environment.Scene.DefaultColor, Elevator = this }); Add(ElevatorConveyor); ElevatorConveyor.Route.Motor.Speed = info.multishuttleinfo.ConveyorSpeed; ElevatorConveyor.LocalYaw = (float)Math.PI; lift = new Shuttle(info.multishuttleinfo, 1, info.Multishuttle); lift.UserData = this; lift.Car.OnPositionChanged += Car_PositionChanged; AddPart(lift); lift.LocalRoll = -(float)Math.PI / 2; lift.Route.Motor.Speed = multishuttleinfo.multishuttleinfo.elevatorSpeed; lift.Car.Visible = false; control = lift.Control; }
public void DetachShuttle(Shuttle s) { if (s == null | shuttles.Count == 0) { return; } int i = 0; while (i < shuttles.Count) { if (shuttles[i] == null) { shuttles.RemoveAt(i); continue; } else { if (shuttles[i] == s) { shuttles[i].AssignTo(null); shuttles.RemoveAt(i); return; } } i++; } }
public Expedition Load(ExpeditionSerializer es) { ID = es.ID; shuttles = new List <Shuttle>(); if (es.shuttles_ID.Count > 0) { foreach (int i in es.shuttles_ID) { AssignShuttle(Shuttle.GetShuttle(i)); } } progress = es.progress; if (es.haveTransmitter) { SurfaceBlock transmitterBasis = GameMaster.mainChunk.GetBlock(es.transmitterPosition) as SurfaceBlock; foreach (Structure s in transmitterBasis.surfaceObjects) { if (s is QuantumTransmitter) { transmitter = s as QuantumTransmitter; transmitter.SetExpedition(this); break; } } } else { transmitter = null; } return(this); }
public async Task AddAndDeleteNewShuttle_Ok() { //Arrange var id = Guid.NewGuid(); var shuttle = new Shuttle { Id = id, Name = "Test" }; //Act await m_repository.CreateAsync(shuttle); //Assert var(_, shuttles) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new ShuttleFilter { SearchTerm = id.ToString() }); Assert.Equal(id, shuttles.First().Id); Assert.Equal("Test", shuttles.First().Name); await m_repository.DeleteAsync(shuttle); var(_, emptyResponse) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new ShuttleFilter { SearchTerm = id.ToString() }); Assert.Empty(emptyResponse); }
public async Task UpdateShuttleAsync(Shuttle shuttle) { try { var validationError = shuttle.Validate(); if (validationError.Any()) { throw new ValidationException($"A validation exception was raised while trying to update a Shuttle : {JsonConvert.SerializeObject(validationError, Formatting.Indented)}"); } await EnsureShuttleExistAsync(shuttle.Id); await CheckExplorersTeamExistAsync(shuttle.ExplorersTeamId); await m_repository.UpdateAsync(new List <Shuttle> { shuttle }); } catch (ValidationException e) { m_logger.LogWarning(e, "A validation failed"); throw; } catch (Exception e) when(e.GetType() != typeof(ValidationException)) { m_logger.LogCritical(e, $"Unexpected Exception while trying to update a Shuttle with the properties : {JsonConvert.SerializeObject(shuttle, Formatting.Indented)}"); throw; } }
public Crew Load(CrewSerializer cs) { salary = cs.salary; count = cs.count; level = cs.level; nextExperienceLimit = cs.nextExperienceLimit; experience = cs.experience; name = cs.name; ID = cs.ID; status = cs.status; perception = cs.perception; persistence = cs.persistence; luck = cs.luck; bravery = cs.bravery; techSkills = cs.techSkills; survivalSkills = cs.survivalSkills; teamWork = cs.teamWork; stamina = cs.stamina; successfulOperations = cs.successfulOperations; totalOperations = cs.totalOperations; if (cs.shuttleID != -1) { shuttle = Shuttle.GetShuttle(cs.shuttleID); shuttle.AddCrew(this); } return(this); }
public async Task UpdateNewShuttle_Ok() { //Arrange var id = Guid.NewGuid(); var shuttle = new Shuttle { Id = id, Name = "Test", }; //Act await m_repository.CreateAsync(shuttle); var(_, shuttles) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new ShuttleFilter { SearchTerm = id.ToString() }); shuttle.Name = "Modified"; await m_repository.UpdateAsync(new List <Shuttle> { shuttle }); var(_, updatedResponse) = await m_repository.SearchAsync(new Pagination(), new Ordering(), new ShuttleFilter { SearchTerm = id.ToString() }); //Assert Assert.Equal(id, shuttles.First().Id); Assert.Equal("Modified", shuttles.First().Name); await m_repository.DeleteAsync(updatedResponse.First()); }
private double CalcFitness(Individual individual) { Shuttle shuttleSim = new Shuttle(shuttle, surface); shuttleSim.PerformLanding(individual.Chromosome); double fitness; if (shuttleSim.FlightStatus == FlightStatus.Landed) { fitness = 10 * shuttleSim.RemainingFuel; } else if (shuttleSim.FlightStatus == FlightStatus.Flying) { fitness = (int)-surface.HorizontalDistanceFromFlatZone(shuttleSim.CurrentLocation); if (!surface.CollideWithGround(shuttleSim.CurrentLocation, new Point(surface.flatMidX, surface.flatY + 1))) { fitness = 50; } } else { fitness = (int)(Math.Min(-Math.Abs(shuttleSim.VerticalSpeed) + 40, 0) + Math.Min(-Math.Abs(shuttleSim.HorizontalSpeed) + 20, 0) + (-Math.Abs(shuttleSim.CurrentFlightInstruction.TiltAngle)) - surface.HorizontalDistanceFromFlatZone(shuttleSim.CurrentLocation)); } individual.Fitness = fitness; return(individual.Fitness); }
public override void ShuttleIn(Shuttle s) { if (!s.shielded) { s.GainShield(); Destroy(gameObject); } }
private void Awake() { //get required references shuttle = shuttle == null?GetComponentInParent <Shuttle>() : shuttle; thrusterArea = thrusterArea == null?GetComponentInChildren <AreaEffector2D>() : thrusterArea; thrusterCol = thrusterCol == null?thrusterArea.GetComponent <Component>() : thrusterCol; }
public void AssignShuttle(Shuttle s) { if (s == null) { return; } shuttles.Add(s); s.AssignTo(this); }
public bool SaveGame(string name) // заменить потом на persistent - постоянный путь { Time.timeScale = 0; GameMasterSerializer gms = new GameMasterSerializer(); #region gms mainPartFilling gms.gameSpeed = gameSpeed; gms.lifeGrowCoefficient = lifeGrowCoefficient; gms.demolitionLossesPercent = demolitionLossesPercent; gms.lifepowerLossesPercent = lifepowerLossesPercent; gms.luckCoefficient = LUCK_COEFFICIENT; gms.sellPriceCoefficient = sellPriceCoefficient; gms.tradeVesselsTrafficCoefficient = tradeVesselsTrafficCoefficient; gms.upgradeDiscount = upgradeDiscount; gms.upgradeCostIncrease = upgradeCostIncrease; gms.environmentalConditions = environmentalConditions; gms.warProximity = warProximity; gms.difficulty = difficulty; gms.startGameWith = startGameWith; gms.prevCutHeight = prevCutHeight; gms.diggingSpeed = diggingSpeed; gms.pouringSpeed = pouringSpeed; gms.manufacturingSpeed = manufacturingSpeed; gms.clearingSpeed = clearingSpeed; gms.gatheringSpeed = gatheringSpeed; gms.miningSpeed = miningSpeed; gms.machineConstructingSpeed = machineConstructingSpeed; gms.day = day; gms.week = week; gms.month = month; gms.year = year; gms.millenium = millenium; gms.t = timeGone; gms.windVector_x = windVector.x; gms.windVector_z = windVector.y; gms.windTimer = windTimer; gms.windChangeTime = windChangeTime; gms.labourTimer = labourTimer; gms.lifepowerTimer = lifepowerTimer; gms.recruiting_hireCost = RecruitingCenter.GetHireCost(); #endregion gms.chunkSerializer = mainChunk.SaveChunkData(); gms.colonyControllerSerializer = colonyController.Save(); gms.dockStaticSerializer = Dock.SaveStaticDockData(); gms.shuttleStaticSerializer = Shuttle.SaveStaticData(); gms.crewStaticSerializer = Crew.SaveStaticData(); gms.questStaticSerializer = QuestUI.current.Save(); gms.expeditionStaticSerializer = Expedition.SaveStaticData(); string path = Application.persistentDataPath + "/Saves/"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } FileStream fs = File.Create(path + name + '.' + SaveSystemUI.SAVE_FNAME_EXTENSION); savename = name; BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, gms); fs.Close(); Time.timeScale = 1; return(true); }
public void UpdateShuttle(Shuttle shuttle) { using (var conn = new SqlConnection(conStr)) { conn.Open(); conn.Update <Shuttle>(shuttle); conn.Close(); } }
public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory) { _webHost = new WebHost(_orchardTemp); Host.Initialize(siteFolder, virtualDirectory ?? "/", _dynamicCompilationOption); var shuttle = new Shuttle(); Host.Execute(() => Executor(shuttle)); _messages = shuttle._sink; }
void Awake() { shuttle = GetComponent <Shuttle>(); Press.performed += Press_Performed; Position.Enable(); Position.performed += x => CurrentPosition = Position.ReadValue <Vector2>(); }
private static void CreateTasksForShuttleRelocation(string code) { var asrs = asrsData.GetAllAsrs().First(x => x.Location == Location.WH_OUT); //çıkış tarafındaki asrs taşıma işiyle ilgili Shuttle shuttle = shuttlesData.GetMoveableShuttleByAddress(code); //shuttle ın taşınma konumuna gitmesi için MachineTask machineTaskShuttle = new MachineTask { OrderDetailPalletId = 0, //boş kalamalı ProductNotificationId = 0, //boş kalamalı TaskType = (int)TaskType.ShATA, TaskBatch = 0, Sequence = 1, MachineCode = shuttle.Code, SourceType = AddressType.ADDRESS, SourceAddress = shuttle.LastAddress, LoadInfo = "", TargetType = AddressType.ADDRESS, TargetAddress = shuttle.LastAddress, //aynı adreste tüp ağzına gitmesi için AssignUser = "******", AssignReason = "STANDART", AssignTime = DateTime.Now, StartTime = null, EndTime = null, SentFlag = false, IsCompleted = false, ErrorCode = null, }; //asrs shuttle alması için MachineTask machineTaskASRS = new MachineTask { OrderDetailPalletId = 0, //boş kalamalı ProductNotificationId = 0, //boş kalamalı TaskType = (int)TaskType.ShATA, TaskBatch = 0, Sequence = 2, MachineCode = asrs.Code, SourceType = AddressType.ADDRESS, SourceAddress = "shuttle ın olduğu adress", LoadInfo = shuttle.Code, TargetType = AddressType.ADDRESS, TargetAddress = code, AssignUser = "******", AssignReason = "STANDART", AssignTime = DateTime.Now, StartTime = null, EndTime = null, SentFlag = false, IsCompleted = false, ErrorCode = null, }; //insert movement tasks tasksData.InsertMachineTask(machineTaskShuttle); tasksData.InsertMachineTask(machineTaskASRS); }
public async Task RegisterCaptainInPlanetMicroservice(Captain captain, Shuttle shuttle) { var uri = new Uri(_config["PlanetAPIUrl"] + "crewMetaData/"); await HttpHelper.PostAsync(uri, new { CaptainIdentifier = captain.Identifier, CaptainName = captain.FirstName + " " + captain.LastName, RobotList = string.Join(",", shuttle.Robots.Select(x => x.Name)), }); }
public override void ShuttleIn(Shuttle s) { float v = Mathf.Pow(Random.value, Game.i.settings.boost.decreasingChanceFactor) * (Game.i.settings.boost.durationRandomRange.y - Game.i.settings.boost.durationRandomRange.x) + Game.i.settings.boost.durationRandomRange.x; s.Boost(v); Destroy(gameObject); }
public Shuttle(Shuttle shuttle, Surface surface) : this(surface) { CurrentLocation = new Point(shuttle.CurrentLocation.X, shuttle.CurrentLocation.Y); CurrentFlightInstruction = new FlightInstruction(shuttle.CurrentFlightInstruction.TiltAngle, shuttle.CurrentFlightInstruction.ThrustPower); HorizontalSpeed = shuttle.HorizontalSpeed; VerticalSpeed = shuttle.VerticalSpeed; RemainingFuel = shuttle.RemainingFuel; FlightStatus = shuttle.FlightStatus; }
public void CleanUpLoadingVars(Map map) { groupID = -1; innerContainer.TryDropAll(parent.Position, map, ThingPlaceMode.Near); if (leftToLoad != null) { leftToLoad.Clear(); } Shuttle?.CleanUpLoadingVars(); }
override public void Load(StructureSerializer ss, SurfaceBlock sblock) { LoadStructureData(ss, sblock); HangarSerializer hs = new HangarSerializer(); GameMaster.DeserializeByteArray <HangarSerializer>(ss.specificData, ref hs); constructing = hs.constructing; LoadWorkBuildingData(hs.workBuildingSerializer); shuttle = Shuttle.GetShuttle(hs.shuttle_id); }
public override void ShuttleIn(Shuttle s) { if (!s.IsFull() && s.on && state == State.FLOATING) { s.Heal(); s.Board(this); EnterState(State.ONBOARD); shuttle = s; } }
public void GivenIHaveACleanSiteBasedOn(string siteFolder) { _webHost = new WebHost(); Host.Initialize(siteFolder, "/"); var shuttle = new Shuttle(); Host.Execute(() => { log4net.Config.BasicConfigurator.Configure(new CastleAppender()); HostingTraceListener.SetHook(msg => shuttle._sink.Receive(msg)); }); _messages = shuttle._sink; }
public IActionResult Dock([FromBody] Shuttle shuttle) { var isValid = _shuttleSpecifications.CheckSpecifications(shuttle); if (isValid) { var result = _shuttleSpecifications.DockShuttle(shuttle).Result; return((result)?Ok(): StatusCode((int)HttpStatusCode.BadRequest)); } return(StatusCode((int)HttpStatusCode.BadRequest)); }
public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory) { _webHost = new WebHost(_orchardTemp); Host.Initialize(siteFolder, virtualDirectory ?? "/", _dynamicCompilationOption); var shuttle = new Shuttle(); Host.Execute(() => { log4net.Config.BasicConfigurator.Configure(new CastleAppender()); HostingTraceListener.SetHook(msg => shuttle._sink.Receive(msg)); }); _messages = shuttle._sink; }
public bool playerCollidesRoof(Shuttle player) { float roofHeight = getRoofHeight (player.shuttleCenterPosition.X); if (player.shuttleCenterPosition.Y-player.radius < roofHeight) { return true; } return false; }
public bool playerCollidesFloor(Shuttle player) { float roofHeight = getFloorHeight (player.shuttleCenterPosition.X); if (player.shuttleCenterPosition.Y+player.radius > roofHeight) { return true; } return false; }
public Vector2 getPlayerStartPosition(Shuttle player) { return new Vector2 (player.radius, getLevelHeight () / 2.0f); }
private static void Executor(Shuttle shuttle) { HostingTraceListener.SetHook(msg => shuttle._sink.Receive(msg)); }
public bool playerReachedEnd(Shuttle player) { if (player.shuttleCenterPosition.X >= getLevelWidth () - player.radius) { return true; } return false; }