Exemple #1
0
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        MovementJob movementJob = new MovementJob
        {
            CurrentSteeringDirection = this.GameInput.CurrentSteeringDirection,
            CurrentMoveDirection     = this.GameInput.CurrentMoveDirection,
            SpeedPedalSenstivity     = Settings.InputSpeedSenstivity,
            SteeringSenstivity       = Settings.SteeringSenstivity,
            TimeDelta            = Time.DeltaTime,
            MaxSpeed             = Settings.MaxSpeed,
            IdleSpeedLoss        = Settings.IdleSpeedLoss,
            BrakePedalSenstivity = Settings.BrakeSenstivity,
        };

        this.InputSnapshots.Add(this.GameInput.CurrentMoveDirection, this.GameInput.CurrentSteeringDirection);

        Entities
        .ForEach((ref CarComponent carComponent, ref Rotation rotation,
                  in HeroComponent heroComponent) =>
        {
            movementJob.Execute(ref carComponent, ref rotation);
        }).Run();

        return(default);