public void FetchState(bool recording = false, TimeSlave applyTo = null) { var storage = (recording ? this.recordingStorage : this.storage); var currentTime = this.time.currentTime; if (storage.Count == 0) { return; } var idx = this.indexOfFirst(storage, t => t >= currentTime); if (idx > 0) { idx--; } if (idx == -1) { idx = storage.Count - 1; } var state = storage[idx]; if (applyTo == null) { applyTo = slave; } applyTo.transform.position = state.position; applyTo.transform.rotation = state.rotation; applyTo.isActive = state.isActive; applyTo.extraState = state.extra; }
public FiniteState(float time, TimeSlave slave) { this.time = time; this.position = slave.transform.position; this.rotation = slave.transform.rotation; this.isActive = slave.isActive; this.extra = slave.extraState; }
void Start() { this.slave = this.GetComponent <TimeSlave>(); if (this.slave) { this.slave.canCreatePhantom = false; } }
void Start() { this.slave = this.GetComponent <TimeSlave>(); if (this.slave) { this.currentTime = this.slave.time.currentTime; } }
private void removeQuantumState(TimeSlave slave) { if (!storage.ContainsKey(slave)) { return; } storage.Remove(slave); slaves.Remove(slave); }
private QuantumState getQuantumState(TimeSlave slave) { if (storage.ContainsKey(slave)) { return(storage[slave]); } this.slaves.Add(slave); return(this.storage[slave] = new QuantumState(this, slave)); }
public QuantumState(TimeController time, TimeSlave slave) { this.time = time; this.slave = slave; }
void Start() { this.characterController = GetComponent <CharacterController>(); this.slave = GetComponent <TimeSlave>(); }
public void RemoveState(TimeSlave slave) { this.removeQuantumState(slave); }
public void FetchState(TimeSlave slave, bool recording = false) { var state = this.getQuantumState(slave.recordingPhantomFor ?? slave); state.FetchState(recording, slave); }
public void RecordState(TimeSlave slave, bool recording = false) { var state = this.getQuantumState(slave); state.RecordState(recording); }
void Start() { slave = GetComponent <TimeSlave>(); }