/** Advances all objects by a certain time (in seconds). */ public void tick() { int numObjects = mObjects.Count; //int currentIndex = 0; int i; mElapsedTime += Time.deltaTime; if (numObjects == 0) { return; } // there is a high probability that the "advanceTime" function modifies the list // of animatables. we must not process new objects right now (they will be processed // in the next frame), and we need to clean up any empty slots in the list. for (i = 0; i < numObjects; ++i) { ITickable obj = mObjects[i]; if (obj != null) { obj.tick(); //++currentIndex; } } }
///--------------------------------------------------------------------- internal static void Register(ITickable tickable) { var aliveTickable = new AliveTickable(tickable); Instance.pendingRegistry.Add(aliveTickable); Instance.allTickables.Add(aliveTickable); }
public void RemoveTask(ITickable task) { var info = _sortedTasks.Concat(_unsortedTasks).Where(x => x.Tickable == task).Single(); Assert.That(!info.IsRemoved, "Tried to remove task twice, task = " + task.GetType().Name); info.IsRemoved = true; }
static void Prefix(ref ITickable __state) { if (Multiplayer.Client == null) { return; } if (!WorldRendererUtility.WorldRenderedNow && Find.CurrentMap == null) { return; } ITickable tickable = Multiplayer.WorldComp; if (!WorldRendererUtility.WorldRenderedNow && Multiplayer.WorldComp.asyncTime) { tickable = Find.CurrentMap.AsyncTime(); } TimeSpeed speed = tickable.TimeSpeed; if (Multiplayer.IsReplay) { speed = TickPatch.replayTimeSpeed; } savedSpeed = Find.TickManager.CurTimeSpeed; Find.TickManager.CurTimeSpeed = speed; prevSpeed = speed; keyPressed = Event.current.isKey; __state = tickable; }
public static void Register(ITickable task, UpdateType updateType = UpdateType.normal) { // be assure instance exist Checkinstance(); var ableTask = Tasks.Find(x => x.InstanceId() == task.InstanceId() && x.InstanceId() != 0); if (ableTask != null) { switch (ableTask) { case MoveTask move: move.Join(((MoveTask)task).CurrentData); break; case DirectionTask drecTask: drecTask.Join(((DirectionTask)task).CurrentData); break; case UpdateTask updateTask: Debug2.Log("update task exist it will add in queue"); updateTask.Join(((UpdateTask)task).currentData); break; } } else { if (updateType == UpdateType.normal) { Tasks.Add(task); } else if (updateType == UpdateType.fixedTime) { FixedTasks.Add(task); } } }
public void RemoveTask(ITickable task) { var info = _tasks.Where(i => ReferenceEquals(i.Tickable, task)).Single(); Assert.That(!info.IsRemoved, "Tried to remove task twice, task = " + task.GetType().Name); info.IsRemoved = true; }
void UpdateTickable(ITickable tickable) { //using (ProfileBlock.Start("{0}.Tick()".With(tickable.GetType().Name()))) { tickable.Tick(); } }
public CameraManager(IResourcesManager resourcesManager, ITickable tickable) { _resourcesManager = resourcesManager; #if UNITY_EDITOR tickable.SecondTick += OnTick; #endif }
public void DeRegister(ITickable tickable) { Debug.Assert(tickable == null, "Trying to deregister a tickable that is null!"); toDeregister.Add(tickable); }
/// <summary> /// Remove a previously added tickable (if you don't want to bother returning /// "true" when something is finished) /// </summary> /// <param name="tickable"></param> public static void RemoveTickable(ITickable tickable) { if (instance.yieldInstructions.Remove(tickable) == false) { throw new InvalidOperationException("Cannot remove something that was not added"); } }
public void Register(ITickable tickable) { if (!this.tickables.Contains(tickable)) { this.tickables.Add(tickable); } }
private void evalSubscribed() { for (int i = 0; i < subscribed.Count; i += 1) { ITickable subscriber = subscribed [i]; subscriber.discreteUpdate(); } }
public static float TimePerTick(this ITickable tickable, TimeSpeed speed) { if (tickable.ActualRateMultiplier(speed) == 0f) { return(0f); } return(1f / tickable.ActualRateMultiplier(speed)); }
public void SetProperties(ITickable tickable, float tickTime) { this.tickable = tickable; this.tickTime = tickTime; this.ticks = 0; this.infinite = true; currentTickTime = 0; }
public void RegisterTickable(ITickable tickable) { if (_tickables.Contains(tickable)) { return; } _tickables.Add(tickable); }
/// <summary> /// Removes this ITickable from TickableManager /// </summary> /// <param name="tickable">Tickable.</param> protected virtual void RemoveTickable(ITickable tickable) { _tManager.Remove(tickable); Publish(new Service.GlobalNetwork.Commands.RemoveTickableCommand() { tickable = this }); }
public void Start(ITickable handler) { for (int i = 0; i < 11; ++i) { handler.TimeChanged(i); System.Threading.Thread.Sleep(1000); } }
public void SetProperties(ITickable tickable, float tickTime, int ticks) { this.tickable = tickable; this.tickTime = tickTime; this.ticks = ticks; this.infinite = false; currentTickTime = 0; }
public static void Join(ITickable obj) { if (objectsToTick == null) { objectsToTick = new List <ITickable>(); } objectsToTick.Add(obj); }
void UpdateTickable(ITickable tickable) { #if PROFILING_ENABLED using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name()))) #endif { tickable.Tick(); } }
//protected override void Dispose(bool disposing) //{ // if (isDisposed) return; // if (disposing) // { // } // // isDisposed = true; //} /// <summary> /// /// </summary> /// <param name="totalTime"></param> /// <param name="elapsedTime"></param> /// <remarks>Do not access this Method directly. Only AetherEngine should call it during the game loop.</remarks> /// <permission cref=""></permission> public override void Tick(GameTime gameTime) { ITickable tickableRoot = Root as ITickable; if (tickableRoot != null) { tickableRoot.Tick(gameTime); } }
public void Unregister(ITickable tickable) { List <ITickable> obj = this.tickables; lock (obj) { this.tickables.RemoveAll((ITickable match) => match == tickable); } }
public static float ActualRateMultiplier(this ITickable tickable, TimeSpeed speed) { if (Multiplayer.WorldComp.asyncTime) { return(tickable.TickRateMultiplier(speed)); } return(Find.Maps.Select(m => (ITickable)m.AsyncTime()).Concat(Multiplayer.WorldComp).Select(t => t.TickRateMultiplier(speed)).Min()); }
public static int CreateStream(ITickable world) { Thread thread = new Thread(new ParameterizedThreadStart(Tick)); var threadId = thread.ManagedThreadId; var container = new ThreadContainer(thread, world, true); IdOfThreads.TryAdd(threadId, container);//добавил в словарь thread.Start(container); return(threadId); }
public void AddTask(ITickable task) { Assert.That(!_queuedTasks.Contains(task), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'"); Assert.That(!_tasks.Any(t => ReferenceEquals(t.Tickable, task)), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'"); // Wait until next frame to add the task, otherwise whether it gets updated // on the current frame depends on where in the update order it was added // from, so you might get off by one frame issues _queuedTasks.Add(task); }
private void DestroyScene() { if (m_controller != null) { m_controller.Dispose(); m_controller = null; } m_tickController = null; }
static bool Prefix(ref float __result, ITickable tickable, TimeSpeed speed) { if (MultiplayerWorldComp.asyncTime) { __result = tickable.TickRateMultiplier(speed) / RefcellRespeedConfig.currentTimeMultiplier; return(false); } __result = Find.Maps.Select(m => (ITickable)m.AsyncTime()).Concat(Multiplayer.Client.Multiplayer.WorldComp).Select(t => t.TickRateMultiplier(speed)).Min() / RefcellRespeedConfig.currentTimeMultiplier; return(false); }
private void Update() { using (List <ITickable> .Enumerator enumerator = this._ticked.GetEnumerator()) { while (enumerator.MoveNext()) { ITickable current = enumerator.get_Current(); current.Tick(Time.get_deltaTime()); } } }
public static void SendTimeChange(ITickable tickable, TimeSpeed newSpeed) { if (tickable is MultiplayerWorldComp) { Multiplayer.Client.SendCommand(CommandType.WorldTimeSpeed, ScheduledCommand.Global, (byte)newSpeed); } else if (tickable is MapAsyncTimeComp comp) { Multiplayer.Client.SendCommand(CommandType.MapTimeSpeed, comp.map.uniqueID, (byte)newSpeed); } }
void AddTaskInternal(ITickable task, int?priority) { Assert.That(!AllTasks.Select(x => x.Tickable).Contains(task), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'"); // Wait until next frame to add the task, otherwise whether it gets updated // on the current frame depends on where in the update order it was added // from, so you might get off by one frame issues _queuedTasks.Add( new TickableInfo(task, priority)); }
public void Remove(ITickable component) { if (_componentsList.Contains(component)) { _componentsList[_componentsList.IndexOf(component)] = null; } else if (_addList.Contains(component)) { _addList.Remove(component); } //_componentsList.Remove(component); //This not allow use Remove on Tick }
public static bool AddAntTick(ITickable ticker, UpdateType type = UpdateType.Update) { if (ticker == null) { return(false); } bool b = Add(ticker.tick, type); ticker.tick(0); return(b); }
void AddTaskInternal(ITickable task, int? priority) { Assert.That(!AllTasks.Select(x => x.Tickable).Contains(task), "Duplicate task added to kernel with name '" + task.GetType().FullName + "'"); // Wait until next frame to add the task, otherwise whether it gets updated // on the current frame depends on where in the update order it was added // from, so you might get off by one frame issues _queuedTasks.Add( new TickableInfo(task, priority)); }
public TickableInfo(ITickable tickable, int? priority) { Tickable = tickable; Priority = priority; }
public TickableInfo(ITickable tickable) : this(tickable, null) { }
/// <summary> /// Convienance function to add an ITickable object into the tick /// manager. /// </summary> public void Add(ITickable tickable) { TickEvent += new TickHandler(tickable.OnTick); }
public void Add(ITickable tickable, int priority) { _updater.AddTask(tickable, priority); }
void InsertTaskSorted(ITickable task) { var newInfo = new TickableInfo(task); for (var current = _tasks.First; current != null; current = current.Next) { if (current.Value.Tickable.TickPriority > task.TickPriority) { _tasks.AddBefore(current, newInfo); return; } } _tasks.AddLast(newInfo); }
public void AddTask(ITickable task) { _impl.AddTask(task); }
public void Remove(ITickable tickable) { _updater.RemoveTask(tickable); }
internal void Add(ITickable tickable) { _ticked.Add(tickable); }
internal void Remove(ITickable tickable) { _ticked.Remove(tickable); }
public void addToUpdateList(ITickable t) { updateList.Add(t); }
public void AddTask(ITickable task) { AddTaskInternal(task, null); }
public void Add(ITickable tickable) { Add(tickable, 0); }
void UpdateTickable(ITickable tickable) { using (ProfileBlock.Start("{0}.Tick()".Fmt(tickable.GetType().Name()))) { tickable.Tick(); } }
public void Add(ITickable tickable) { _ticker.Add(tickable); }
public void AddTask(ITickable task, int priority) { AddTaskInternal(task, priority); }
public void RemoveTask(ITickable task) { _impl.RemoveTask(task); }
public TickableInfo(ITickable tickable) { Tickable = tickable; }