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