Exemplo n.º 1
0
    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;
    }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 void Start()
 {
     this.slave = this.GetComponent <TimeSlave>();
     if (this.slave)
     {
         this.slave.canCreatePhantom = false;
     }
 }
Exemplo n.º 4
0
 void Start()
 {
     this.slave = this.GetComponent <TimeSlave>();
     if (this.slave)
     {
         this.currentTime = this.slave.time.currentTime;
     }
 }
Exemplo n.º 5
0
 private void removeQuantumState(TimeSlave slave)
 {
     if (!storage.ContainsKey(slave))
     {
         return;
     }
     storage.Remove(slave);
     slaves.Remove(slave);
 }
Exemplo n.º 6
0
 private QuantumState getQuantumState(TimeSlave slave)
 {
     if (storage.ContainsKey(slave))
     {
         return(storage[slave]);
     }
     this.slaves.Add(slave);
     return(this.storage[slave] = new QuantumState(this, slave));
 }
Exemplo n.º 7
0
 public QuantumState(TimeController time, TimeSlave slave)
 {
     this.time  = time;
     this.slave = slave;
 }
Exemplo n.º 8
0
 void Start()
 {
     this.characterController = GetComponent <CharacterController>();
     this.slave = GetComponent <TimeSlave>();
 }
Exemplo n.º 9
0
 public void RemoveState(TimeSlave slave)
 {
     this.removeQuantumState(slave);
 }
Exemplo n.º 10
0
    public void FetchState(TimeSlave slave, bool recording = false)
    {
        var state = this.getQuantumState(slave.recordingPhantomFor ?? slave);

        state.FetchState(recording, slave);
    }
Exemplo n.º 11
0
    public void RecordState(TimeSlave slave, bool recording = false)
    {
        var state = this.getQuantumState(slave);

        state.RecordState(recording);
    }
Exemplo n.º 12
0
 void Start()
 {
     slave = GetComponent <TimeSlave>();
 }