public override string Update(Job job, Phase phase, string body = null, string contentType = null, string accept = null) { job.UpdateState(JobStateType.INPROGRESS, "UPDATE to " + phase.Name); string response; if (!contentType.ToLower().Equals("application/xml")) { response = "Invalid Content-Type, expecting application/xml"; job.UpdatePhaseState(phase.Name, PhaseStateType.FAILED, response); throw new RejectedException(response); } LearnerPersonal data; try { data = SerialiserFactory.GetXmlSerialiser<LearnerPersonal>().Deserialise(body); } catch(Exception e) { response = "Error decoding xml data: " + e.Message; job.UpdatePhaseState(phase.Name, PhaseStateType.FAILED, response); throw new RejectedException(response, e); } NameType name = data.PersonalInformation.Name; job.UpdatePhaseState(phase.Name, PhaseStateType.COMPLETED, "UPDATE"); response = "Got UPDATE message for " + phase.Name + "@" + job.Id + " with content type " + contentType + " and accept " + accept + ".\nGot record for learner:" + name.GivenName + " " + name.FamilyName; return response; }
protected override void StateChanged() { switch((EntityState)prevState) { case EntityState.Normal: bodyCtrl.inputEnabled = false; ToPhase(Phase.None); break; } base.StateChanged(); switch((EntityState)state) { case EntityState.Normal: mNextPhase = Phase.TargetStrike; bodyCtrl.inputEnabled = true; ToPhase(Phase.Move); break; case EntityState.Dead: ToPhase(Phase.Dead); break; case EntityState.Invalid: ToPhase(Phase.None); break; } }
void DisplayTexts(Phase phase) { string topTextString = ""; string bottomTextString = ""; switch (phase) { case Phase.Memorizes: topTextString = this.maxMonsterNumber + HIKI; bottomTextString = MEMORIZES_BOTTOM; break; case Phase.Player: topTextString = ATO + (this.maxMonsterNumber - this.killedMonster) + HIKI;; bottomTextString = GAME_BOTTOM; break; } this.topText.guiText.text = topTextString; this.bottomText.guiText.text = bottomTextString; this.levelText.guiText.enabled = true; this.topText.guiText.enabled = true; this.bottomText.guiText.enabled = true; }
public static double ClientReceive() { double t = clientBuffer; clientBuffer = EmptyBuffer; phase = Phase.Send; return t; }
private void SetPhase(Phase phase) { if (this.phase != phase) { this.phase = phase; switch (phase) { case Phase.None: PlayMusic(""); break; case Phase.Intro: PlayMusic("Intro Music"); break; case Phase.Scene: PlayMusic("Scene Music"); break; case Phase.EndingInfiltratorWins: PlayMusic("Outro Music Good"); break; case Phase.EndingSectWins: PlayMusic("Outro Music Evil"); break; } } }
/// <summary> /// The update methods follows the flow of: /// Input (user enters input (swipe,touch)) /// Player character processes input /// Non-player characters process input /// </summary> public void Update() { switch (gamePhase) { case Phase.INPUT: { if(inputManager.TouchListener(out command)) { gamePhase = Phase.PLAYER; } break; } case Phase.PLAYER: { player.GetComponent<Player>().PhaseBehavior(command); gamePhase = Phase.ENEMY; break; } case Phase.ENEMY: { foreach(GameObject e in enemies) { e.GetComponent<Enemy>().PhaseBehavior(command); } gamePhase = Phase.INPUT; break; } } }
public static void ChangePhase(Phase phase) { if (instance != null) { instance.SetPhase(phase); } }
public static List<Phase> GetPhases1() { List<Phase> results = new List<Phase>(); Phase p = new Phase(); p.Id = REGISTERED; p.Name = "REGISTERED"; results.Add(p); p = new Phase(); p.Id = SCANNING; p.Name = "SCANNING"; results.Add(p); p = new Phase(); p.Id = MANIPULATION; p.Name = "MANIPULATION"; results.Add(p); p = new Phase(); p.Id = PRINTING; p.Name = "PRINTING"; results.Add(p); return results; }
public void ExecuteTest1() { var complex = new Complex(3.1, 2.5); var exp = new Phase(new ComplexNumber(complex)); Assert.Equal(complex.Phase, exp.Execute()); }
public override void onStartRide() { foreach (motor m in motors) { m.GetAxis(this.gameObject); } base.onStartRide(); foreach (motor m in motors) { m.Enter(); } if (phases.Count <= 0) { animating = false; return; } foreach (motor m in motors) { m.Enter(); } animating = true; phaseNum = 0; currentPhase = phases[phaseNum]; currentPhase.running = true; currentPhase.Enter(); currentPhase.Run(); }
static void ResSetup(Status s) { if (s == Status.Cancelled) phase = Phase.Inactive; else phase = Phase.Active; }
public void ToStringTest() { var complex = new Complex(3.1, 2.5); var exp = new Phase(new ComplexNumber(complex)); Assert.Equal("phase(3.1+2.5i)", exp.ToString()); }
public OperationalSpeedCommand GetSpeedCommand() { OperationalVehicleState vs = Services.StateProvider.GetVehicleState(); OperationalSpeedCommand cmd = new OperationalSpeedCommand(); cmd.brakePressure = TahoeParams.brake_hold; cmd.engineTorque = 0; if (result != CompletionResult.Failed) { if (phase == Phase.Braking) { // chek if we can transition to shifting if (Math.Abs(vs.speed) < 0.05 && vs.brakePressure >= TahoeParams.brake_hold-1) { phase = Phase.Shifting; } } if (phase == Phase.Shifting) { cmd.transGear = gear; if (vs.transGear == gear) { result = CompletionResult.Completed; } } } return cmd; }
internal override void OnACK_UpdateWindow(RUDPOutgoingPacket packet) { //---- Reset _outOfOrderCount = 0; //---- Check the phase if (CWND <= _ssthresh) Phase = Phase.SlowStart; else Phase = Phase.CongestionAvoidance; //---- Slow start if (Phase == Phase.SlowStart) { // Exponential grow CWND += _rudp.MTU; } //---- Congestion avoidance if (Phase == Phase.CongestionAvoidance) { // (increase of 1 packet every RTT) // This is a linear growth of cwnd. CWND += (_rudp.MTU * _rudp.MTU) / CWND; } //---- Check boundaries CWND = Math.Max(Math.Min(_awnd, _cwnd), _rudp._mtu); //---- Update slow start threshold if (_ssthresh < CWND) _ssthresh = Math.Min(64 * 1024, CWND); }
static void Calibrate() { double data = double.Parse(buffer); // compute with data (not shown) phase = Phase.WaitForEvent; // CalRequested = false; }
public ActionResult delete(int id) { PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); //GET PHASE try { phase = phase_rep.getPhase(id); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve phase: " + exception.Message; return RedirectToAction("Index"); } //DELETE PHASE try { phase_rep.delete(phase); TempData["flash"] = "Deleted phase."; return RedirectToAction("Index"); } catch (Exception exception) { TempData["flash"] = "Unable to delete phase: " + exception.Message; return RedirectToAction("Index"); } }
public LoginSocket(long s, uint addr, int port) : base(s, addr, port) { phase = Phase.Seed; PredefinedPacketSizes = new int[] { 4, 62 }; Trace.WriteLine("Login socket created.", "Communication"); }
public void lowerRoof(){ if( m_Phase == Phase.Wait ) { m_Tweener.Play(true); m_Phase = Phase.InMotion; } else { Debug.Log("Error! Invalid tween state of the roof"); } }
public void startDone(){ if( m_Phase == Phase.InMotion ){ m_Tweener.tweenGroup = 1; m_Phase = Phase.Wait; } else { Debug.Log("Error! Invalid tween state of the roof"); } }
public static void Calibrate() { Console.WriteLine(" Calibrate '" + buffer + "'"); double data = double.Parse(buffer); // compute with data (not shown) phase = Phase.WaitForEvent; // CalRequested = false; }
/// <summary> /// Servo smoothly from the joint's present position to a new target position and stay there. /// Do this in a constant period (i.e. large movements happen more quickly). /// This is a good way to move a head towards a target of interest. /// </summary> /// <param name="target">Target position of joint</param> /// <param name="period">Time over which the movement should take place</param> public void ServoWithinPeriod(float target, float period) { begin = state; // start from where you are now end = target; // end at target attackPeriod = period; // in this many seconds' time sustainPeriod = float.MaxValue; // stay there indefinitely phase = Phase.Transition; }
public static void UpdatePhase(Phase phase) { CurrentPhase = phase; PlayerTurn.GetInstance().UpdatePhase(phase); TilingGrid.GetInstance().EntityPhase = phase; MenuContainer.GetInstance().UpdatePhase(phase); LogoPanel.GetInstance().EntityPhase = phase; }
/// <summary> /// Servo smoothly from the joint's present position to a new target position and stay there. /// Do this at a roughly constant rate (i.e. large movements take longer than small ones). /// This is good for heavy, ponderous heads. /// </summary> /// <param name="target">Target position of joint</param> /// <param name="rate">Speed (e.g. 0.5 will move through the whole range of the joint in 0.5 seconds /// or half the range in 0.25 sec) </param> public void ServoAtRate(float target, float rate) { begin = state; // start from where you are now end = target; // end at target sustainPeriod = float.MaxValue; // stay there indefinitely attackPeriod = (end-begin) * rate; // move in appropriate fraction of the total period phase = Phase.Transition; }
void ChangePhase(Phase phase) { Phase p = (Phase)Instantiate(phase); currentPhase.SetInactive(); p.previousPhase = currentPhase; currentPhase = p; currentPhase.SetActive(); elapsedTime = 0.0f; }
internal void reset() { evaluationFunction = null; factor = new ushort[Color.COLOR_NB]; gamePhase = Phase.PHASE_ENDGAME; key = 0; scalingFunction = new EndgameScaleFactor[Color.COLOR_NB]; value = 0; }
public ActionResult create() { //Generate new phase object PhaseRepository phase_rep = new PhaseRepository(); Phase phase = new Phase(); ViewData["edit"] = false; ViewData["phase"] = phase; return View(); }
internal override void Reset() { base.Reset(); _cwnd = _rudp._mtu; Phase = Phase.SlowStart; _ssthresh = _MaxSSthresh; }
public Timer(float duration, int timerId, TimerType type = TimerType.Once, int times = -1) { countDown = 0.0f; this.duration = duration; this.timerId = timerId; this.type = type; state = Phase.NeverStart; this.times = times; }
public void SetPhase(PhaseController.Phase p) { phase = p; if(phase == Phase.End || phase == Phase.Read) ObjectSpawnController.instance.spawning = true; else ObjectSpawnController.instance.spawning = false; }
/// <summary> /// The constructor of DataManager class. /// </summary> /// <param name="commandData">The ExternalCommandData</param> public DataManager(ExternalCommandData commandData) { m_commandData = commandData; m_levels = new List<Level>(); Initialize(); m_currentLevel = m_levels[0]; Parameter para = commandData.Application.ActiveUIDocument.Document.ActiveView.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.VIEW_PHASE); Autodesk.Revit.DB.ElementId phaseId = para.AsElementId(); m_defaultPhase = commandData.Application.ActiveUIDocument.Document.get_Element(phaseId) as Phase; }
private Series GetSeriesInfo(Meter meter, ChannelKey channelKey, SeriesKey seriesKey) { Series dbSeries = meter.Channels .SelectMany(channel => channel.Series) .FirstOrDefault(series => seriesKey.Equals(new SeriesKey(series))); if ((object)dbSeries == null) { using (AdoDataConnection connection = meter.ConnectionFactory()) { Channel dbChannel = meter.Channels .FirstOrDefault(channel => channelKey.Equals(new ChannelKey(channel))); if ((object)dbChannel == null) { TableOperations <Channel> channelTable = new TableOperations <Channel>(connection); TableOperations <MeasurementType> measurementTypeTable = new TableOperations <MeasurementType>(connection); TableOperations <MeasurementCharacteristic> measurementCharacteristicTable = new TableOperations <MeasurementCharacteristic>(connection); TableOperations <Phase> phaseTable = new TableOperations <Phase>(connection); MeasurementType measurementType = measurementTypeTable.GetOrAdd(channelKey.MeasurementType); MeasurementCharacteristic measurementCharacteristic = measurementCharacteristicTable.GetOrAdd(channelKey.MeasurementCharacteristic); Phase phase = phaseTable.GetOrAdd(channelKey.Phase); dbChannel = new Channel() { MeterID = meter.ID, LineID = channelKey.LineID, MeasurementTypeID = measurementType.ID, MeasurementCharacteristicID = measurementCharacteristic.ID, PhaseID = phase.ID, Name = channelKey.Name, SamplesPerHour = 0, Description = string.Concat(channelKey.MeasurementCharacteristic, " ", channelKey.MeasurementType, " ", channelKey.Phase), Enabled = true }; channelTable.AddNewRecord(dbChannel); dbChannel.ID = connection.ExecuteScalar <int>("SELECT @@IDENTITY"); meter.Channels = null; } TableOperations <Series> seriesTable = new TableOperations <Series>(connection); TableOperations <SeriesType> seriesTypeTable = new TableOperations <SeriesType>(connection); SeriesType seriesType = seriesTypeTable.GetOrAdd(seriesKey.SeriesType); dbSeries = new Series() { ChannelID = dbChannel.ID, SeriesTypeID = seriesType.ID, SourceIndexes = string.Empty }; seriesTable.AddNewRecord(dbSeries); dbSeries.ID = connection.ExecuteScalar <int>("SELECT @@IDENTITY"); dbChannel.Series = null; dbSeries = meter.Channels .SelectMany(channel => channel.Series) .First(series => seriesKey.Equals(new SeriesKey(series))); } } return(dbSeries); }
// Update is called once per frame public override void Update() { base.Update(); switch (phase) { case Phase.MOVE: if (Mathf.Abs(transform.position.x - (iTargetX - TileManager.width / 2 + 0.5f)) > 0.1f) { // Walk to target transform.localPosition += new Vector3(Time.deltaTime * fSpeed * (bFlip ? -1.0f : 1.0f), 0.0f, 0.0f); } else { transform.localPosition = new Vector3(iTargetX - TileManager.width / 2 + 0.45f, 0.625f, -3.0f); SetAnim(unloadAnim); fTimeUntilNextPhase = 5.0f; phase = Phase.UNLOAD; } break; case Phase.UNLOAD: fTimeUntilNextPhase -= Time.deltaTime; if (fTimeUntilNextPhase <= 0.0f) { SetAnim(drillAnim); phase = Phase.DRILL; // Redo based on player depth and duration of game so far iTargetDepth = Random.Range(1, 7); // Spawn plans for (int i = 0; i < iTargetDepth; i++) { Transform plans = Instantiate <Transform>(drillPlansPrefab); plans.SetParent(transform); plans.localPosition = new Vector3(0.05f, -1.03125f - i, 0.2f); drillPlans.Add(plans); } Transform end = Instantiate <Transform>(drillPlansEndPrefab); end.SetParent(transform); end.localPosition = new Vector3(0.05f, -1.03125f - iTargetDepth, 0.2f); drillPlans.Add(end); drillBit = Instantiate <Transform>(drillBitEndPrefab); drillBit.SetParent(transform); drillBit.localPosition = new Vector3(0.05f, -0.625f, 0.1f); drillPlans.Add(drillBit); // Warn! for (int i = 0; i < iTargetDepth; i++) { TileBase tb = Core.theTM.GetTileBase(iTargetX, i); if (!tb.IsLizardy() && tb.Type() != TileBase.TileType.FILLED) { // Something solid is in the way iTargetDepth = i + 1; } tb.bWarning = true; if (tb.IsLizardy()) { TextTicker.AddLine("Warning: Humans are about to drill into our " + tb.printName); } } } break; case Phase.DRILL: // Do some drilling fDrillProgress += fDrillSpeed * Time.deltaTime; int iDrillProgress = Mathf.FloorToInt(fDrillProgress); float fRemainder = fDrillProgress - iDrillProgress; if (iDrillProgress >= drills.Count) { drills.Add(Instantiate <SpriteRenderer>(drillBitPrefab)); topDrill = drills[drills.Count - 1]; topDrill.transform.SetParent(transform); // We just hit a new spot. if (iDrillProgress >= 1) { if (!Core.theTM.HumanDigTile(iTargetX, iDrillProgress - 1)) { CeaseDrilling(); } } if (iDrillProgress > iTargetDepth) { CeaseDrilling(); } } for (int i = 0; i < drills.Count; i++) { drills[i].transform.localPosition = new Vector3(0.05f, -0.03125f - i - fRemainder, 0.1f); } drillBit.localPosition = new Vector3(0.05f, -0.625f - fDrillProgress, 0.1f); break; case Phase.LEAVE: transform.localPosition += new Vector3(Time.deltaTime * fSpeed * (bFlip ? -1.0f : 1.0f), 0.0f, 0.0f); if (transform.position.x > 12.0f || transform.position.x < -12.0f) { Destroy(gameObject); } break; } }
// Update is called once per frame void Update() { time = Time.time; if (Application.targetFrameRate != target) { Application.targetFrameRate = target; } if (Time.time >= targetTime) { switch (currentPhase) { case Phase.ENTRY: targetTime = Time.time + pictureCooldown; currentPhase = Phase.PICTURE; rend1.material.mainTexture = textures[order[pos]]; rend2.material.mainTexture = textures[order[pos]]; AppendLog("PICTURE"); break; case Phase.PICTURE: targetTime = Time.time + pauseCooldown; currentPhase = Phase.PAUSE; rend1.material.mainTexture = blackTexture; rend2.material.mainTexture = blackTexture; AppendLog("PAUSE"); break; case Phase.PAUSE: subPhase++; if (subPhase < subPhasesCount) { targetTime = Time.time + pictureCooldown; rend1.material.mainTexture = textures[order[pos]]; rend2.material.mainTexture = textures[order[pos]]; currentPhase = Phase.PICTURE; AppendLog("PICTURE"); } else { pos++; if (pos < order.Length) { subPhase = 0; targetTime = Time.time + entryCooldown; rend1.material.mainTexture = blackTexture; rend2.material.mainTexture = blackTexture; currentPhase = Phase.ENTRY; AppendLog("ENTRY"); } else { rend1.material.mainTexture = endTexture; rend2.material.mainTexture = endTexture; if (!endShow) { AppendLog("END"); endShow = true; } } } break; } } }
public void SetPhase(Phase phase) { m_phase = phase; Debug.Log("Phase = " + phase); }
// Start is called before the first frame update async void Start() { phase = Phase.Start; //await Test(); //await StartPouring(); }