该项目是使用Unity DOTS 实现的经典 Pong 游戏的简单实现。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

20 行
490 B

using Unity.Entities;
using Unity.Jobs;
using UnityEngine;
[AlwaysSynchronizeSystem]
public class PlayerInputSystem : JobComponentSystem
{
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
Entities.ForEach((ref PaddleMovementData moveData, in PaddleInputData inputData) =>
{
moveData.direction = 0;
moveData.direction += Input.GetKey(inputData.upKey) ? 1 : 0;
moveData.direction -= Input.GetKey(inputData.downKey) ? 1 : 0;
}).Run();
return default;
}
}