Beispiel #1
0
 public void ResetSprites(ControllerSlot[] slots, StatePhysics state)
 {
     for (var index = 0; index < slots.Length; index++)
     {
         slots[slots.Length - index - 1].Image.sprite = _slotSprites[(state.IndexCurrent + index) % _slotSprites.Length];
     }
 }
Beispiel #2
0
 public void StateResetIdle(StatePhysics model)
 {
     model.Acceleration = 0f;
     model.Friction     = -.02f;
     model.Speed        = 0f;
     model.IndexCurrent = UnityEngine.Random.Range(0, _slots);
     model.IndexTarget  = model.IndexCurrent;
 }
        public void Setup(IContext context, StatePhysics state)
        {
            var data = context.Resolve <ContainerApp>();

            state.IndexTarget = _indexTarget;
            state.DelayPeriod = _lastPeriod + (data.SpinTimeStepMax - data.SpinTimeStepMin).Random();
            state.StartStamp  = DateTime.UtcNow;
            _lastPeriod       = state.DelayPeriod;
        }
Beispiel #4
0
        public void StateUpdate(StatePhysics model)
        {
            model.Speed = Time.deltaTime * (model.Acceleration + model.Friction) + model.Speed;
            model.Speed = model.Speed < 0f ? 0f : model.Speed;

            var isGoal =
                DateTime.UtcNow - model.StartStamp > model.DelayPeriod &&
                model.IndexTarget == model.IndexCurrent;

            if (isGoal)
            {
                model.Speed        = 0f;
                model.RenderOffset = 0f;
            }
        }
Beispiel #5
0
 public void StateResetRoll(StatePhysics model)
 {
     model.Friction = -.02f;
     model.Speed    = Time.deltaTime * (14f + UnityEngine.Random.value * 2f + model.Friction);
 }