您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
873 B
33 行
873 B
using Unity.Entities;
|
|
using Unity.NetCode;
|
|
|
|
|
|
public class PlayerControlled
|
|
{
|
|
public struct State : IComponentData
|
|
{
|
|
public UserCommand command;
|
|
public UserCommand prevCommand;
|
|
|
|
[GhostDefaultField]
|
|
public int resetCommandTick;
|
|
[GhostDefaultField(10)]
|
|
public float resetCommandLookYaw;
|
|
[GhostDefaultField(10)]
|
|
public float resetCommandLookPitch; // = 90;
|
|
public int lastResetCommandTick;
|
|
|
|
public bool IsButtonPressed(UserCommand.Button button)
|
|
{
|
|
return command.buttons.IsSet(button) && !prevCommand.buttons.IsSet(button);
|
|
}
|
|
|
|
public void ResetCommand(int tick, float lookYaw, float lookPitch)
|
|
{
|
|
resetCommandTick = tick;
|
|
resetCommandLookYaw = lookYaw;
|
|
resetCommandLookPitch = lookPitch;
|
|
}
|
|
}
|
|
|
|
}
|