您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
19 行
467 B
19 行
467 B
using Unity.Entities;
|
|
using Unity.Jobs;
|
|
using UnityEngine;
|
|
|
|
public class PlayerInputSystem : JobComponentSystem
|
|
{
|
|
protected override JobHandle OnUpdate(JobHandle inputDeps)
|
|
{
|
|
Entities.ForEach((ref PaddleInputData inputData, ref PaddleMovementData moveData) =>
|
|
{
|
|
moveData.direction = 0;
|
|
|
|
moveData.direction += Input.GetKey(inputData.upKey) ? 1 : 0;
|
|
moveData.direction -= Input.GetKey(inputData.downKey) ? 1 : 0;
|
|
}).Run();
|
|
|
|
return inputDeps;
|
|
}
|
|
}
|