public override void ExitAction(StateEnum destinationState) { if (destinationState == StateEnum.Default) { stateData.grabber.DeleteHeldObject(); } }
protected virtual void ReportSuccess() { if (_state == StateEnum.Ok) { return; } lock (Lock) { if (_state == StateEnum.Failed) { _concurrentRequestHadSuccess = true; _latestRequestHadSuccess = true; return; } if (_state == StateEnum.ContenderIsTrying) { ConsecutiveContenderErrors = 0; } _state = StateEnum.Ok; FirstFailureAt = null; LatestException = null; _options.CoolDownStrategy.Reset(); } }
public MyGuiScreenLoadSandbox() : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(0.95f, 0.8f)) { EnabledBackgroundFade = true; m_state = StateEnum.ListNeedsReload; RecreateControls(true); }
//-------------------------------------------------------------- // CONSTRUCTORS //-------------------------------------------------------------- public BluetoothManager() { _deviceAddress = string.Empty; _handler = new MyHandler (); _bluetoothAdapter = BluetoothAdapter.DefaultAdapter; _state = StateEnum.None; }
public void CastSkill(int skillID, Vector3 displacement) { var costMP = GetSkillCostMP(skillID, displacement.magnitude); if (GetSkillTotalCDRemaining(skillID) > 0 || !GetSkillCountEnough(skillID)) { return; } switch (skillID) { case 0://跳跃 if (State == StateEnum.Static && Data.mp + 0.1f >= costMP) { State = StateEnum.Jumping; var jumpingTime = MainController.Instance.JumpingTime; DestinationPosition = transform.localPosition + displacement; Data.JumpTime = 0; GetComponent<Rigidbody>().velocity = displacement/jumpingTime - Vector3.up*0.5f*MainController.JumpingGravity*jumpingTime; if (Animator) { Animator.SetTrigger("Jump"); } } break; } CmdCastAtkSkill(skillID, displacement); }
public void Init(Camera controlCamera) { State = StateEnum.Idle; HideUI(); _controlCamera = controlCamera; enabled = true; }
public void ShowDot(string text) { m_state = StateEnum.DisplayDot; m_displayText = text; panelTimecost.gameObject.SetActive(false); panelLog.gameObject.SetActive(true); }
public void ForceRetract() { if (State == StateEnum.Extend) { State = StateEnum.Retract; } }
// Update is called once per frame void Update() { Agent.updatePosition = false; Agent.updateRotation = false; Agent.updateUpAxis = false; NextState -= Time.deltaTime; switch (State) { case StateEnum.RUN: if (Agent.desiredVelocity.magnitude < 0.1f) { State = StateEnum.SHOOT; NextState = Random.Range(1f, 7f); } break; case StateEnum.SHOOT: if (NextState < 0) { State = StateEnum.RUN; target = PotentialTargets[Random.Range(0, PotentialTargets.Length)]; Agent.SetDestination(target.transform.position); } break; } transform.position += Agent.desiredVelocity * Time.deltaTime; }
/// <summary> /// AI - 代理权: 如果我拥有了它的控制权, 则状态机要在这里运行, ActorVisualizer的同名函数会继续运行(接受本函数发送的消息) /// </summary> /// <param name="bytes"></param> private void OnActorAiStateHighReply(byte[] bytes) { ActorAiStateHighReply input = ActorAiStateHighReply.Parser.ParseFrom(bytes); if (input.ActorId != ActorId) { return; // 不是自己,略过 } if (!input.Ret) { return; } // 如果本地AI可以控制本单位, 或者是当前玩家自己, 则继续, 否则这里返回 if (!HasAiRights && input.OwnerId != GameRoomManager.Instance.CurrentPlayer.TokenId) { return; } HighAiState = (StateEnum)input.HighAiState;// 记录高级AI状态 HighAiTargetCell = input.HighAiCellIndexTo; HighAiTargetId = 0; var abTarget = GameRoomManager.Instance.RoomLogic.ActorManager.GetActor(input.HighAiTargetId); if (abTarget != null && !abTarget.IsDead) { HighAiTargetId = input.HighAiTargetId; } HighAiDurationTime = input.HighAiDurationTime; HighAiTotalTime = input.HighAiTotalTime; StateMachine.TriggerTransition((StateEnum)input.HighAiState, input.HighAiCellIndexTo, input.HighAiTargetId, input.HighAiDurationTime, input.HighAiTotalTime); }
public void TouchedCollider2D(Collider2D other) { if (Target) { return; //有猎物就不要在处理碰撞了 } if (other.gameObject.layer == EnemyFighter.LAYER_ENEMY) { var ef = other.GetComponent <EnemyFighter>(); if (ef) { State = StateEnum.Retract; ClawHead.collider2D.enabled = false; Target = ef; HeadPos = Target.Position + (Position - Target.Position).normalized * ClawHead.ContentPosition.localPosition.y; Velocity = Vector2.zero; ef.BeGrabbed(this); } else { Debug.LogError("怎么可能没有脚本,检查bug"); } } }
void drawWindowMouseDown(MouseEventArgs e) { Point loc = e.Location; float locDist = Distance(loc); if (TopButton.Area.Contains(loc)) { m_state = StateEnum.HoldingScrollUpButton; smallScrollUpIncrement(); timer1.Start(); } else if (BottomButton.Area.Contains(loc)) { m_state = StateEnum.HoldingScrollDownButton; smallScrollDownIncrement(); timer2.Start(); } else if (locDist >= LowHeight && locDist <= HighHeight) { m_state = StateEnum.Dragging; m_dragStart = locDist; m_dragValue = RatioValue; } else if (locDist > HighHeight) { m_state = StateEnum.EmptyScrollDown; timer4.Start(); } else if (locDist < LowHeight) { m_state = StateEnum.EmptyScrollUp; timer3.Start(); } Invalidate(true); }
public Square(Board board, int row, int column) { this.board = board; this.row = row; this.column = column; state = StateEnum.Empty; }
public FormCreator(ReminderCreator creator) { InitializeComponent(); SetText("修改"); var CategoryList = reminder.CategoryList.ToArray(); comboBox1.Items.AddRange(CategoryList); SetCategory(creator.Category); comboBox2.SelectedIndex = (int)creator.Importance; state = StateEnum.Modify; oldCreator = creator; textBox1.Text = oldCreator.Title; textBox2.Text = oldCreator.Text; textBox3.Text = oldCreator.TimeCode; timeList = oldCreator.TimeCache; var builder = new StringBuilder(); foreach (var time in oldCreator.TimeCache) { builder.AppendLine(time.ToString("yyyy-MM-dd HH:mm:ss")); } if(oldCreator.AllInCache) { builder.AppendLine("END"); } textBox4.Text = builder.ToString(); TimeCodeValid = true; }
void StartWaitCounterAttack() { CurrentState = StateEnum.WaitCounterAttack; Time.timeScale = 0.25f; timeAtStartWaitCounterAttack = Time.time; }
public void ShowTimecost(float time) { m_state = StateEnum.DisplayTime; m_costTime = time; panelTimecost.gameObject.SetActive(true); panelLog.gameObject.SetActive(false); }
public void Stop() { state = StateEnum.IDLE; source.Sprite.color = new Color(source.Sprite.color.r, source.Sprite.color.g, source.Sprite.color.b, 1f); this.unit.gameObject.SetActive(false); }
// Start is called before the first frame update void Awake() { Agent = GetComponent <NavMeshAgent>(); PotentialTargets = FindObjectsOfType <Target>(); target = PotentialTargets[Random.Range(0, PotentialTargets.Length)]; State = StateEnum.RUN; }
public IActionResult PageIndex(string deptName, string detpSearchId, int?state, int pageindex = 0, int pagesize = 10) { List <Expression <Func <Department, bool> > > searchs = new List <Expression <Func <Department, bool> > >(); if (!string.IsNullOrEmpty(deptName)) { searchs.Add(x => x.Name.Contains(deptName)); } if (state != null && state != -1) { StateEnum stateEnum = (StateEnum)state; searchs.Add(x => x.State == stateEnum); } if (!string.IsNullOrEmpty(detpSearchId)) { IBaseService <Department, Guid> deptBaseService = _deptManageService as IBaseService <Department, Guid>; var entity = deptBaseService.Get(x => x.Id.ToString() == detpSearchId).FirstOrDefault(); if (entity != null) { searchs.Add(x => x.EnCode.StartsWith(entity.EnCode)); } } Dictionary <string, bool> orderDic = new Dictionary <string, bool> { { "SortCode", true } }; var pageList = _deptManageService.GetDeptPageList(pagesize, pageindex, out int totalcount, searchs, orderDic); return(JsonContent(new { rows = pageList, total = totalcount })); }
/// <summary> /// AI取点 /// </summary> /// <param name="board"></param> /// <param name="step"></param> /// <param name="Lev"></param> /// <returns></returns> public PieceInfo AIGetNext(Board board, int Lev = 0) { List <PieceInfo> returnLt = new List <PieceInfo>(); BoardInfo boardInfo = new BoardInfo(board); StateEnum flag = boardInfo.DeepAnalyze(); //StateEnum flag = boardInfo.Result; returnLt = boardInfo.MaxLt; PieceInfo point = returnLt[0]; if (boardInfo.MaxLev == LevelEnum.Five_1) { return(point); } if (flag == StateEnum.Loss || flag == StateEnum.D) { point = MoreDefend(boardInfo, board); } else { point = GetBest(returnLt); } return(point); }
public void Logger(Vector3 lookAtPoint) { if (recorderState == RecorderState.recording) { if (previousState == StateEnum.InAir && state == StateEnum.OnGround) { //filled log section inserted into session, and skip if just started recording if (logSection != null) { sessionLog.logSections.Add(logSection); } //clear old data for new ones logSection = new LogSection(); logSection.sector = GetSector(); } LogLine logLine = new LogLine(); logLine.time = Time.time; logLine.state = state; logLine.action = action; logLine.playerPosition = Point3.ToPoint(player.position); logLine.cameraRotation = Rotation4.ToRotation(playerCamera.rotation); logLine.lookAtPoint = Point3.ToPoint(lookAtPoint); logSection.logLines.Add(logLine); previousState = state; } }
private PlayerState ChangeTo(StateEnum state) { switch (state) { case StateEnum.Default: currState = new PlayerStateDefault(stateData); break; case StateEnum.Context: currState = new PlayerStateContextMenu(stateData); break; case StateEnum.Pocket: currState = new PlayerStatePocketMenu(stateData); break; case StateEnum.Canvas: currState = new PlayerStateCanvasMenu(stateData); break; case StateEnum.Inventory: currState = new PlayerStateInventoryMenu(stateData); break; case StateEnum.Hold: currState = new PlayerStateHolding(stateData); break; } return(currState); }
public SocketInfo(Socket socket, short headerLength, bool noEncryption) { Socket = socket; State = StateEnum.Header; NoEncryption = noEncryption; DataBuffer = new byte[headerLength]; Index = 0; }
public void Stop() { _rigidbody.velocity = Vector3.zero; if (State != StateEnum.Idle) { State = StateEnum.Idle; _animator.SetBool("Running", false); } }
public void Stop() { _navMeshAgent.Stop(); if (State != StateEnum.Idle) { State = StateEnum.Idle; _animator.SetBool("Running", false); } }
public void OnPointerDown(PointerEventData eventData) { State = StateEnum.InvalidDragging; PressPosition = eventData.pressPosition; CurrentPosition = eventData.position; var pos = PressPosition * 1800f/Screen.width; TouchCircle.localPosition = pos; TouchSpot.localPosition = Vector3.zero; }
IEnumerator Pause() { if (pauseKeyPressed) { Time.timeScale = 0; GameState = StateEnum.Pause; } yield break; }
public void WalkTo(Vector3 position) { _navMeshAgent.Resume(); _navMeshAgent.SetDestination(position); if (State != StateEnum.Running) { State = StateEnum.Running; _animator.SetBool("Running", true); } }
public void OnPointerUp(PointerEventData eventData) { CurrentPosition = eventData.position; State = StateEnum.Idle; TouchCircle.gameObject.SetActive(false); TouchSpot.gameObject.SetActive(false); DragDrop.gameObject.SetActive(false); OriginalDrop.SetActive(true); }
public void OnPointerUp(PointerEventData eventData) { CurrentPosition = eventData.position; ResetAssistPlaneRotation(); if (_directionWalker) _directionWalker.Stop(); if (_pathfindingWalker) _pathfindingWalker.Stop(); State = StateEnum.Idle; HideUI(); }
public AI_Action GetAcition() { if (actions.Count == 0) return new AI_Action(); AI_Action action = actions[0]; actions.RemoveAt(0); if (actions.Count == 0) state = StateEnum.Idle; return action; }
public void WalkTowards(Vector3 direction) { var velocity = direction.normalized * Speed; _rigidbody.velocity = velocity; transform.forward = velocity; if (State != StateEnum.Running) { State = StateEnum.Running; _animator.SetBool("Running", true); } }
private void SensorInit(string Id, string State, string Description, float PingInterval) { this.Id = Id; this.State = (StateEnum)Enum.Parse(typeof(StateEnum), State); this.Description = (Description == null) ? "(None)" : Description; this.PingInterval = PingInterval; this.LastMsgSent = null; this.LastReading = -1; this.LastReadingTime = string.Empty; // Default Date value, meaning uninitialized }
public void OnPointerDown(PointerEventData eventData) { State = StateEnum.InvalidDragging; PressPosition = eventData.pressPosition; CurrentPosition = eventData.position; Debug.LogFormat("CurrentPosition=" + CurrentPosition); var pos = PressPosition * 1800f / Screen.width; TouchCircle.localPosition = pos; RefreshJoystickUI(Vector2.zero); ShowUI(); }
public FormCreator() { InitializeComponent(); SetText("添加新"); comboBox1.Items.AddRange(reminder.CategoryList.ToArray()); comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 1; state = StateEnum.New; oldCreator = null; }
public void Init() { _directionWalker = Walker.GetComponent<DirectionWalker>(); _pathfindingWalker = Walker.GetComponent<PathfindingWalker>(); State = StateEnum.Idle; TouchCircle.gameObject.SetActive(false); TouchSpot.gameObject.SetActive(false); DragDrop.gameObject.SetActive(false); if (JoystickAssistCircle) JoystickAssistCircle.gameObject.SetActive(false); if (JoystickAssistSpot) JoystickAssistSpot.gameObject.SetActive(false); }
public void OnPointerDown(PointerEventData eventData) { State = StateEnum.InvalidDragging; PressPosition = eventData.pressPosition; CurrentPosition = eventData.position; Debug.LogFormat("OnPointerDown(CurrentPosition={0})@{1}", CurrentPosition, Time.frameCount); var pos = PressPosition * 1800f / Screen.width; if (TouchCircle) TouchCircle.localPosition = pos; if (TouchSpot) TouchSpot.localPosition = Vector3.zero; if (OnPointerDownEvent != null) OnPointerDownEvent(this); }
public bool ExecuteTask() { output.Clear(); output.Add(new TaskMessage("Test Task")); //MainClass.MainWindow.OutputConsole.WriteText("message"); //ProcessWrapper pw =MainClass.ProcessService.StartProcess("cmd.exe","/c dir *.*", MainClass.Tools.AppPath, ProcessOutputChange, ProcessErrorChange); //MainClass.MainWindow.RunProcess("cmd.exe", "/c dir *.*", MainClass.Tools.TempDir); //Console.WriteLine("teST TASk BEZI"); stateTask = StateEnum.ERROR; return false; }
public void Init(Unit playerUnit) { State = StateEnum.Idle; MainController.Instance.Arrow2.gameObject.SetActive(false); MainController.Instance.ThinArrow.gameObject.SetActive(false); MainController.Instance.FocusedUnit.UnitInfoCanvas.SprCostMP.gameObject.SetActive(false); TouchCircle.gameObject.SetActive(false); TouchSpot.gameObject.SetActive(false); DragDrop.gameObject.SetActive(false); OriginalDrop.SetActive(true); enabled = true; //gameObject.SetActive(false); }
public static string GetClassForStateValue(this WebViewPage page, StateEnum s) { switch (s) { case StateEnum.Waiting: return "ticket open"; case StateEnum.InResolution: return "ticket responded"; case StateEnum.Terminated: return "ticket closed"; } return ""; }
/// <summary> /// Implementing the ISerializable to provide a faster, more optimized /// serialization for the class. /// </summary> /// <param name="info"></param> /// <param name="context"></param> public SuperPoolCall(SerializationInfo info, StreamingContext context) { // Get from the info. SerializationReader reader = new SerializationReader((byte[])info.GetValue("data", typeof(byte[]))); Id = reader.ReadInt64(); State = (StateEnum)reader.ReadInt32(); RequestResponse = reader.ReadBoolean(); Parameters = reader.ReadObjectArray(); string methodInfoName = reader.ReadString(); _methodInfoName = methodInfoName; MethodInfoLocal = SerializationHelper.DeserializeMethodBaseFromString(_methodInfoName, true); }
public void OnPointerUp(PointerEventData eventData) { CurrentPosition = eventData.position; ResetAssistPlaneRotation(); State = StateEnum.Idle; TouchCircle.gameObject.SetActive(false); TouchSpot.gameObject.SetActive(false); DragDrop.gameObject.SetActive(false); if (JoystickAssistCircle) JoystickAssistCircle.gameObject.SetActive(false); if (JoystickAssistSpot) JoystickAssistSpot.gameObject.SetActive(false); if (!UsePathfinding) _directionWalker.Stop(); else _pathfindingWalker.Stop(); }
public TestingBlock(string line, int id, int prevID, double size, int[] loc, bool track, bool sw, bool tunnel, bool heater, bool crossing, bool station, StateEnum state) { _line = line; _id = id; _prevID = prevID; State = StateEnum.Healthy; BlockSize = size; _location = loc; _track = track; _sw = sw; _tunnel = tunnel; _heater = heater; _crossing = crossing; _station = station; _state = state; }
public void Load(string exampleDir, Bitmap bitmap) { spaceshipBitmap = bitmap; sprites = new List<Sprite>(); spriteSize = new Vector2(41, 44); size = 2.0f; Sprite newSprite; for (int i = 0; i < 3; i++) { newSprite = new Sprite(); newSprite.Bitmap = spaceshipBitmap; newSprite.SrcRect = new Rectangle(i * (int)spriteSize.X, 0, (int)spriteSize.X, (int)spriteSize.Y); newSprite.Scaling = new Vector2(size, size); sprites.Add(newSprite); } currentSprite = 0; state = StateEnum.Idle; Position = new Vector2(100, 100); speed = new Vector2(0, 0); angleToMousePointer = 0; RestartPosition(); GuiController.Instance.UserVars.addVar("elapsed"); GuiController.Instance.UserVars.addVar("speedX"); GuiController.Instance.UserVars.addVar("speedY"); GuiController.Instance.UserVars.addVar("PosX"); GuiController.Instance.UserVars.addVar("PosY"); GuiController.Instance.UserVars.addVar("MousePosX"); GuiController.Instance.UserVars.addVar("MousePosY"); GuiController.Instance.UserVars.addVar("AngleMouse"); GuiController.Instance.UserVars.addVar("Misiles"); }
public FormItem(ReminderItem item) { InitializeComponent(); SetText("修改"); var CategoryList = reminder.CategoryList.ToArray(); comboBox1.Items.AddRange(CategoryList); SetCategory(item.Category); comboBox2.SelectedIndex = (int)item.Importance; state = StateEnum.Modify; oldItem = item; textBox1.Text = oldItem.Title; textBox2.Text = oldItem.Text; dateTimePicker1.Value = oldItem.Time; }
/// <summary> /// A public constructor for block objects. The constructor takes an argument for each datafield in the /// object, allowing them all to be initialized at once. /// </summary> /// <param name="bID">The block ID of the block</param> /// <param name="state">The StateEnum state of the block (Healthy, TrackCircuitFailure, etc)</param> /// <param name="pBID">The previous* block ID of the block.</param> /// <param name="sElev">The cumulative elevation of the block</param> /// <param name="g">The grade of the track on this block</param> /// <param name="loc">An X,Y pair stored in an integer array representing the </param> /// <param name="bS">The block size of this block</param> /// <param name="dir">The DirEnum direction of the block</param> /// <param name="atts">An array of infrastructure attributes for the block</param> /// <param name="d1">The block ID of the next* block.</param> /// <param name="d2">The block ID of the alternate next* block. Only valid if block has switch</param> /// <param name="tCID">The Track Circuit ID that the given block reports on</param> /// <param name="l">The line of the current block: either "Red" or "Green"</param> /// <param name="sL">The Speed Limit of the block. Trains must maintain speeds below posted limits</param> public Block(int bID, StateEnum state, int pBID, double sElev, double g, int[] loc, double bS, DirEnum dir, string[] atts, int d1, int d2, int tCID, string l, int sL) { _blockID = bID; State = state; _prevBlockID = pBID; _startingElev = sElev; _grade = g; _location = loc; BlockSize = bS; _direction = dir; _attributes = atts; _switchDest1 = d1; SwitchDest2 = d2; _trackCirID = tCID; _line = l; _speedLimit = sL; }
void Update() { switch (State) { case StateEnum.Idle: break; case StateEnum.Jumping: _jumpingTime += Time.deltaTime; var f = Mathf.Clamp01(_jumpingTime/JumpingDuration); var h = JumpingCurve.Evaluate(f)*JumpingHeight; transform.position = Vector3.Lerp(CellularMap.Instance[StartIJ].transform.position, CellularMap.Instance[DestinationIJ].transform.position, f).SetV3Y(BasicHeight + JumpingHeight*h); if (f >= 0.5f) IJ = DestinationIJ; if (f >= 1f) { State = StateEnum.Idle; } break; } }