Ejemplo n.º 1
0
        public ITeleportState Interpolate(ITeleportState other, float progress01)
        {
            var otherState = (TeleportTransformState)other;
            var newState   = new TeleportTransformState(InstanceId);

            newState.Position = Vector3.Lerp(Position, otherState.Position, progress01);
            newState.Rotation = Quaternion.Lerp(Rotation, otherState.Rotation, progress01);
            return(newState);
        }
        public ITeleportState[] GetCurrentStates()
        {
            ushort         instanceId;
            GameObject     instance;
            ITeleportState state;
            var            states     = new ITeleportState[_instanceByInstanceId.Count];
            int            stateIndex = 0;

            foreach (var pair in _instanceByInstanceId)
            {
                instanceId = pair.Key;
                instance   = pair.Value;
                state      = new TeleportTransformState(instanceId);
                state.FromInstance(instance);
                states[stateIndex++] = state;
            }
            return(states);
        }