public void JumpRelative(byte value, ref ushort pc) { sbyte signed = unchecked ((sbyte)value); pc = (ushort)(pc + signed); TickEvent?.Invoke(); }
void Handle(TickEvent e) { constraint.ForEachGameObject((egoComponent, commandManager) => { List <ICommand> commandList; if (!e.reverse) { if (commandManager.commandDictionary.TryGetValue(e.tick, out commandList)) { foreach (ICommand command in commandList) { command.ExecuteIfValid(); //Debug.Log("executed command"+ command.ToString());; } } } else { if (commandManager.commandDictionary.TryGetValue(e.tick + 1, out commandList)) { foreach (ICommand command in commandList) { command.UndoIfValid(); //Debug.Log("undid comamand"); } } commandList.Clear(); } }); }
static void Simulate(IDictionary <int, ITickObjectClient> dict, float normalizedTime, TickObjectEnumerator etor) { TickEvent ev = InstancePool.Get <TickEvent>(); uint serverTick = SyncManagerClient.Instance.serverTick; while (etor.MoveNext()) { TickObject obj = etor.Current; ITickObjectClient tickObject; if (dict.TryGetValue(obj.Id, out tickObject)) { for (int i = 0; i < obj.EventsLength; ++i) { obj.GetEvents(ev, i); if (serverTick == ev.Tick) { tickObject.EventUpdate(ev); break; } } if (!tickObject.predict) { tickObject.Lerping(normalizedTime, obj); } if (obj.TickObjectLength > 0 && null != tickObject.children) { Simulate(tickObject.children, normalizedTime, new TickObjectEnumerator(obj)); } } } }
static VectorOffset SampleEvents(ITickObject obj, FlatBufferBuilder fbb, bool full) { VectorOffset vecOffset = default(VectorOffset); if (!full && obj.eventType != TickEventType.NONE) { var eventVector = OffsetArrayPool.Alloc <TickEvent>((int)snapshotOverTick); for (uint i = 0; i < snapshotOverTick; ++i) { int eventOffset = obj.SnapshotEvent(fbb, tickCount - snapshotOverTick + i); if (eventOffset > 0) { eventVector.offsets[eventVector.position++] = TickEvent.CreateTickEvent( fbb, tickCount - snapshotOverTick + i, obj.eventType, eventOffset); } } TickObject.StartEventsVector(fbb, eventVector.position); vecOffset = Helpers.SetVector(fbb, eventVector); OffsetArrayPool.Dealloc(ref eventVector); } return(vecOffset); }
private void RingHandler(bool state) { if (_snoozeHandel != null && !_snoozeHandel.IsDone) { return; } if (state) { _ui.ToggleAlarmHint(false); _ui.ToggleAlarmBar(true); _ringHandel = new TickEvent( TickUtils.SecToTicks(_wakeUpSecs), tick => { _controller.AlarmPress -= RingHandler; _ui.ToggleAlarmBar(false); foreach (var animator in _hoomans) { animator.SetBool(Wake, true); } }, tick => { _ui.UpdateAlarmBar((float)tick / (_wakeUpSecs * 5)); }, TickEvent.Type.MICRO); } else { _ui.ToggleAlarmHint(true); _ui.ToggleAlarmBar(false); _ringHandel?.Destroy(); } }
// Use this for initialization protected override void Init() { span40 = new TickEvent(40); span40.SetFunction(Attack); span600 = new TickEvent(600); span600.SetFunction(ChangeAttack); }
void Handle(TickEvent e) { constraint.ForEachGameObject((egoComponent, transform, aimover, inputQueue, movement) => { aimover.movementStrategy.Move(transform, inputQueue, movement); }); }
private void OnTick(object?state) { var tickevent = new TickEvent(); _logger.LogTrace("Publishing {tickevent} at {now}", nameof(TickEvent), tickevent.Time); _eventAggregator.Publish(tickevent); }
protected override void Init() { int moveBlank = (ParamMax + 5 - Param.Agility) * 6; _onMove = new TickEvent(moveBlank); _onMove.AddListener(TimingMovement); }
void Handle(TickEvent e) { if (!e.reverse) { constraint.ForEachGameObject((egoComponent, inputQueueC) => { switch (e.tick % 80) { case 1: //Debug.Break(); SetMovementDirection(Vector3.forward, inputQueueC); break; case 20: SetMovementDirection(Vector3.left, inputQueueC); break; case 37: SetMovementDirection(Vector3.back, inputQueueC); break; case 59: SetMovementDirection(Vector3.right, inputQueueC); break; } }); } }
public void RaiseTickEvent() { if (TickEvent != null) { TickEvent.Invoke(this, e); } }
public SimpleEngine() { _enabled = false; Interval = 1; thread = new Thread(delegate() { while (true) { if (_enabled) { TickEvent.Invoke(this, 0); } Thread.Sleep((int)(Interval * 1000)); // 至少等待Interval秒 } }); var time = DateTime.Now; TickEvent += (sender, tick) => { var newtime = DateTime.Now; //Trace.WriteLine(newtime-time); // 测试函数,显示间隔 #if DEBUG Fps = (int)(1000 / (newtime - time).TotalMilliseconds); Notify("Fps"); #endif time = newtime; Trace.Flush(); }; }
public void Push(ref ushort pointer, byte valueHigh, byte valueLow) { pointer -= 2; TickEvent?.Invoke(); memory.WriteWord(pointer, BitUtils.BytesToUshort(valueHigh, valueLow)); TickEvent?.Invoke(); TickEvent?.Invoke(); }
public void ReturnConditional(ref ushort sp, ref ushort pc, Flag flag, bool condition, byte flags) { TickEvent?.Invoke(); if (FlagUtils.GetFlag(flag, flags) == condition) { Return(ref sp, ref pc); } }
public void Return(ref ushort sp, ref ushort pc) { pc = memory.ReadWord(sp); TickEvent?.Invoke(); TickEvent?.Invoke(); sp = (ushort)(sp + 2); TickEvent?.Invoke(); }
public void DecrementWord(ref byte targetHigh, ref byte targetLow) { ushort target = BitUtils.BytesToUshort(targetHigh, targetLow); target = (ushort)(target - 1); targetHigh = BitUtils.MostSignificantByte(target); targetLow = BitUtils.LeastSignificantByte(target); TickEvent?.Invoke(); }
public void Call(ushort address, ref ushort sp, ref ushort pc) { sp = (ushort)(sp - 2); memory.WriteWord(sp, pc); TickEvent?.Invoke(); TickEvent?.Invoke(); pc = address; TickEvent?.Invoke(); }
// Use this for initialization protected override void Init() { spanEv = new TickEvent(span); spanEv.SetFunction(Shot); if (GameObject.FindGameObjectWithTag("Player")) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <ShootingPlayerBase>(); } }
public void Pop(ref byte valueHigh, ref byte valueLow, ref ushort pointer) { ushort value = memory.ReadWord(pointer); pointer += 2; TickEvent?.Invoke(); TickEvent?.Invoke(); valueHigh = BitUtils.MostSignificantByte(value); valueLow = BitUtils.LeastSignificantByte(value); }
void Handle(TickEvent e) { if (e.reverse) { constraint.ForEachGameObject((egoComponent, input, inputQueueC) => { inputQueueC.inputQueue.Clear(); }); } }
public TickEvent newTickEvent(float secondsPerTick) { GameObject g = UnityEngine.Object.Instantiate(this.tickEventPrefab); g.transform.SetParent(this.transform); TickEvent te = g.GetComponent <TickEvent>(); te.init(secondsPerTick); return(te); }
public void WriteToAddressAndIncrement(ref byte addrHigh, ref byte addrLow, byte value, short addValue) { ushort address = BitUtils.BytesToUshort(addrHigh, addrLow); memory.WriteByte(address, value); TickEvent?.Invoke(); address = (ushort)(address + addValue); addrHigh = BitUtils.MostSignificantByte(address); addrLow = BitUtils.LeastSignificantByte(address); }
public void SetBit(byte addrHigh, byte addrLow, int index, bool bit) { ushort address = BitUtils.BytesToUshort(addrHigh, addrLow); byte data = memory.ReadByte(address); TickEvent?.Invoke(); SetBit(ref data, index, bit); memory.WriteByte(address, data); TickEvent?.Invoke(); }
public void RotateLeftThroughCarry(byte addrHigh, byte addrLow, ref byte flags) { ushort address = BitUtils.BytesToUshort(addrHigh, addrLow); byte data = memory.ReadByte(address); TickEvent?.Invoke(); RotateLeftThroughCarry(ref data, ref flags, false); memory.WriteByte(address, data); TickEvent?.Invoke(); }
public void LoadFromAddressAndIncrement(ref byte dest, ref byte addrHigh, ref byte addrLow, short value) { ushort address = BitUtils.BytesToUshort(addrHigh, addrLow); dest = memory.ReadByte(address); TickEvent?.Invoke(); address = (ushort)(address + value); addrHigh = BitUtils.MostSignificantByte(address); addrLow = BitUtils.LeastSignificantByte(address); }
public void Swap(byte addrHigh, byte addrLow, ref byte flags) { ushort address = BitUtils.BytesToUshort(addrHigh, addrLow); byte data = memory.ReadByte(address); TickEvent?.Invoke(); Swap(ref data, ref flags); memory.WriteByte(address, data); TickEvent?.Invoke(); }
private void OnTimerEvent(object sender, ElapsedEventArgs args) { _timeRemainingInSeconds -= 1; TickEvent?.Invoke(this, EventArgs.Empty); if (_timeRemainingInSeconds <= 0) { Expire(); } }
public TimerEngine() { _tick = 0; Elapsed += delegate(object sender, ElapsedEventArgs e) { lock (this) { TickEvent.Invoke(this, _tick++); } }; }
void ICountdownService.Reset() { if (-1 == infoPtr) { return; } base.Stop(); CurrentInfo = countdownInfos[infoPtr]; TickEvent?.Invoke(CurrentInfo); }
private static void TickLoop(UInt64 times) { UInt64 i = 0; while (i != times) { GameTick++; TickEvent?.Invoke(null, GameTick); i++; } }
public Timer(int ticks, int interval, TickEvent tickEvent) { this.Ticks = ticks; this.Interval = interval; this.Event = tickEvent; }
public virtual void Tick(TickEvent e) { }
public override void Tick(TickEvent e) { GénererBonus(random.Next(0, 3)); SeDeplacer(); }