//对象在平面上的平移动作 public UAction ApplyMoveToTrans(GameObject obj, Vector3 target, float speed, ActionCompleted completed) { MoveToTrans ac = obj.AddComponent <MoveToTrans>(); ac.setting(obj, target, speed, completed); return(ac); }
/// <summary> /// Init this task /// </summary> private void GenerateAction() { byte[] buffer; int blockNumber; lock (Instance) buffer = Source.GetPortionData(out blockNumber); Action calcHashFunc = () => { int blockNum = blockNumber; byte[] block = buffer; using (var sha256 = SHA256.Create()) { var hashedBytes = sha256.ComputeHash(block); var hash = BitConverter.ToString(hashedBytes).Replace("-", string.Empty).ToLower(); string res = $"{blockNum} ->{block.Length} ->{Thread.CurrentThread.ManagedThreadId} ->{hash}"; Result = TaskWriteObjectToFile.GetInstance(StringSource.GetInstance(res)); ActionCompleted?.Invoke(this); } }; ActionToRun = calcHashFunc; }
public void setting(Vector3 target, float speed, ActionCompleted monitor) { this.target = target; this.speed = speed; this.monitor = monitor; GameSceneController.GetInstance().Set_move(true); }
public Action ApplyMoveToAction(GameObject obj, Vector3 target, float speed, ActionCompleted completed)//重载函数 { MoveToAction action = obj.AddComponent <MoveToAction>(); action.getAction(target, speed, completed); return(action); }
public void getAction(Vector3 target, float speed, ActionCompleted monitor) { Director.getInstance().setState(true); this.target = target; this.speed = speed; this.monitor = monitor; }
/// <summary> /// Прошивка выполняется в параллельном потоке /// </summary> public void ActionThread() { var Result = Executer.Exec(Env, Tool, Project, Script, Script.Actions[Action], CompiledArgs); Debug.WriteLine(String.Format(" {0:s}: {1:s}", (Result.Result != ExecResultType.Error) ? "OK" : "FAIL", Result.Message)); ActionCompleted?.Invoke(this, new ActionEventArgs(Action, Result)); }
public void Handle(ActionCompleted e) { if (CanHandle(e.Id)) { _model.ActionCompleted(e.ActionId); } }
public void getAction(GameObject obj, Vector3 target, float speed, ActionCompleted monitor) { this.obj = obj; this.target = target; this.speed = speed; this.monitor = monitor; Director.getInstance().setState(true); this.MoveYZ(); }
public void RunAction(int Index) { Action = Index; Cancelled = false; if (Index < Script.Actions.Count) { Thread Thr = new Thread(ActionThread); Thr.Start(); } else { ActionCompleted?.Invoke(this, new ActionEventArgs(Action, new ERError("Invalid action index"))); } }
private void Move(ref float p1, float p2) { if (p1 != p2) { int mult = (p1 < p2) ? 1 : -1; float inc = _speed * mult; if (Math.Abs(p1 - p2) <= _speed) { p1 = p2; IsDestroyed = true; ActionCompleted.Invoke(this, new EventArgs()); } else { p1 += inc; } } }
public void OnShoot() { while (true) { if (rng.Next(0, 100) % 2 == 0) { if (ActionCompleted != null) { ActionCompleted.Invoke(this, EventArgs.Empty); } } else { Console.WriteLine("Missed"); } Thread.Sleep(500); } }
public void setting(GameObject obj, Vector3 target, float speed, ActionCompleted monitor) { this.obj = obj; this.target = target; this.speed = speed; this.monitor = monitor; GameSceneController.GetInstance().Set_move(true); /*obj比target高,先移动target.z, 再移动target.y * obj比target低,先移动target.y,再移动target.z */ if (target.y < obj.transform.position.y) { Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z); ActionManager.get_instance().ApplyMoveToAction(obj, targetZ, speed, this); } else { Vector3 targetY = new Vector3(target.x, target.y, obj.transform.position.z); ActionManager.get_instance().ApplyMoveToAction(obj, targetY, speed, this); } }
public void When(ActionCompleted e) { Actions[e.ActionId].MarkAsCompleted(); }
public void AddActionCompletedListener <T>(ActionCompleted OnCompleted) where T : Action { GetAction <T>().OnActionCompleted += OnCompleted; }
public void RaiseActionCompleted(EventModel eventModel) { ActionCompleted?.Invoke(this, eventModel); }
protected virtual void OnActionCompleted(string filename, string actionName) { ActionCompleted?.Invoke(this, new ActionEventArgs(filename, actionName)); }
protected void TriggerEvent(T data) { ActionCompleted?.Invoke(data); }
protected virtual void OnActionCompleted(TimeSpan obj) { ActionCompleted?.Invoke(obj); }
protected virtual void OnActionCompleted(EventArgs e) { ActionCompleted?.Invoke(this, e); }