private void OnRunExampleCountryUpdatePosition(object sender, EventArgs e) { createCountry(); ILogicalTime currentTime; ILogicalTimeInterval timeStep; ILogicalTime nextTime; for (int i = 0; i < 5; i++) { currentTime = rtiAmbassador.QueryLogicalTime(); timeStep = rtiAmbassador.Federate.HLAlookahead; nextTime = currentTime.Add(timeStep); rtiAmbassador.TimeAdvanceRequest(nextTime); do { rtiAmbassador.EvokeMultipleCallbacks(0.5, 1.0); currentTime = rtiAmbassador.QueryLogicalTime(); }while (!currentTime.Equals(nextTime)); aNewCountry.Position = new Sxta.Rti1516.Samples.Vector3FloatStruct( aNewCountry.Position.XComponent + 400 * i, aNewCountry.Position.YComponent + 200 * i, aNewCountry.Position.ZComponent + i / 3); System.Threading.Thread.Sleep(1000); } OnDumpObjects(null, null); }
protected void SimulationMoveActor(Actor anActor, Home aTarget) { if (isActorInLocation(anActor, anActor.Home)) { if (anActor.Home.BoxesCount > 0 || initialTime) { // Función que calcule la llegada ILogicalTime currentTime = rti.QueryLogicalTime(); ILogicalTimeInterval intervalTimeArriveAtTheTarget = GetArrivalTimeToTarget(anActor, aTarget); ILogicalTime timeArriveAtTheTarget = currentTime.Add(intervalTimeArriveAtTheTarget); NotifiesBoxInHouse(timeArriveAtTheTarget); MoveActor(anActor, aTarget); anActor.Home.BoxesCount = 0; } } else { initialTime = false; if (!isActorInTarget(anActor, aTarget)) { MoveActor(anActor, aTarget); } // El muñeco está en el destino else { scenario.MoveActorToHome(anActor.Home.PosX, anActor.Home.PosY); sendedBoxInHouseInteraction = false; } } }