protected override JobHandle OnUpdate(JobHandle inputDeps) { var job = new InputSystemJob() { movement = inputMaster.Movement.Move.ReadValue <Vector2>(), jump = inputMaster.Movement.Jump.ReadValue <float>() == 1f }; return(job.Schedule(this, inputDeps)); }
protected override JobHandle OnUpdate(JobHandle inputDependancy) { float horizontalIn = Input.GetAxis("Horizontal"); float verticalIn = Input.GetAxis("Vertical"); var job = new InputSystemJob() { hzIn = horizontalIn, vrIn = verticalIn }; return(job.Schedule(this, inputDependancy)); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { var inputType = GetArchetypeChunkComponentType <InputComponent>(false); var job = new InputSystemJob() { InputComponent = inputType, Horizontal = Input.GetAxis("Horizontal"), Vertical = Input.GetAxis("Vertical") }; return(job.Schedule(m_Group, inputDeps)); }
protected override JobHandle OnUpdate(JobHandle inputDependencies) { var job1 = new MovementInputSystemJobPlayer1(); float2 directionAxis; #if UNITY_EDITOR var job2 = new MovementInputSystemJobPlayer2(); float2 directionAxis2; if (TryGetMovementDirectionAxis(out directionAxis, out directionAxis2 #else if (TryGetMovementDirectionAxis(out directionAxis #endif )) { job1.directionAxisPlayer = directionAxis; #if UNITY_EDITOR job2.directionAxisPlayer = directionAxis2; job2.speed = MovementSystem.MaxSpeed; #endif job1.speed = MovementSystem.MaxSpeed; } else { job1.speed = 0; #if UNITY_EDITOR job2.speed = 0; #endif } bool shieldAction = TryGetShield(); bool fireAction = Fire(); if (shieldAction) { var shieldQuery = EntityManager.CreateEntityQuery(typeof(ShieldComponent), typeof(Player1_tag)); using (var shields = shieldQuery.ToEntityArray(Allocator.TempJob)) foreach (var sh in shields) { var shield = EntityManager.GetComponentData <ShieldComponent>(sh); shield.shieldOn = !shield.shieldOn; EntityManager.SetComponentData(sh, shield); } } if (fireAction) { var playerQuery = EntityManager.CreateEntityQuery(typeof(PlayerComponent), typeof(Player1_tag)); using (var players = playerQuery.ToEntityArray(Allocator.TempJob)) foreach (var e in players) { //EntityManager.AddComponentData(e, new ReadyToSpawnBulletComponent()); EntityManager.AddComponentData(e, new AttemptedToFireTag()); } } #if UNITY_EDITOR bool fireActionP2 = Fire2(); bool shieldAction2 = TryGetShield2(); if (shieldAction2) { var shieldQuery = EntityManager.CreateEntityQuery(typeof(ShieldComponent), typeof(Player2_tag)); using (var shields = shieldQuery.ToEntityArray(Allocator.TempJob)) foreach (var sh in shields) { var shield = EntityManager.GetComponentData <ShieldComponent>(sh); shield.shieldOn = !shield.shieldOn; EntityManager.SetComponentData(sh, shield); } } if (fireActionP2) { var playerQuery = EntityManager.CreateEntityQuery(typeof(PlayerComponent), typeof(Player2_tag)); using (var players = playerQuery.ToEntityArray(Allocator.TempJob)) foreach (var e in players) { //EntityManager.AddComponentData(e, new ReadyToSpawnBulletComponent()); EntityManager.AddComponentData(e, new AttemptedToFireTag()); } } #endif if (Respawn()) { var deadPlayerQuery = EntityManager.CreateEntityQuery(typeof(HitByDeadlyComponent)); using (var deadPlayers = deadPlayerQuery.ToEntityArray(Allocator.TempJob)) foreach (var player in deadPlayers) { if (!EntityManager.HasComponent <PlayerComponent>(player)) { EntityManager.AddComponentData(player, new RespawnRequest()); break; } } } var dummy = new InputSystemJob(); #if UNITY_EDITOR return(dummy.Schedule(this, job2.Schedule(this, job1.Schedule(this, inputDependencies)))); #else return(dummy.Schedule(this, job1.Schedule(this, inputDependencies))); #endif }