浏览代码

refactor: Rename ClientInputSender

/main
Luke Stampfli 4 年前
当前提交
0a009825
共有 2 个文件被更改,包括 58 次插入0 次删除
  1. 47
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs
  2. 11
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs.meta

47
Assets/BossRoom/Scripts/Client/ClientInputSender.cs


using BossRoom.Shared;
using MLAPI;
using UnityEngine;
namespace BossRoom.Client
{
/// <summary>
/// Captures inputs for a character on a client and sends them to the server.
/// </summary>
[RequireComponent(typeof(NetworkCharacterState))]
public class ClientInputSender : NetworkedBehaviour
{
private NetworkCharacterState networkCharacter;
public override void NetworkStart()
{
// TODO Don't use NetworkedBehaviour for just NetworkStart [GOMPS-81]
if (!IsClient || !IsOwner)
{
enabled = false;
}
}
void Awake()
{
networkCharacter = GetComponent<NetworkCharacterState>();
}
void FixedUpdate()
{
// TODO replace with new Unity Input System [GOMPS-81]
// Is mouse button pressed (not just checking for down to allow continuous movement inputs by holding the mouse button down)
if (Input.GetMouseButton(0))
{
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
{
// The MLAPI_INTERNAL channel is a reliable sequenced channel. Inputs should always arrive and be in order that's why this channel is used.
networkCharacter.InvokeServerRpc(networkCharacter.SendCharacterInputServerRpc, hit.point, "MLAPI_INTERNAL");
}
}
}
}
}

11
Assets/BossRoom/Scripts/Client/ClientInputSender.cs.meta


fileFormatVersion: 2
guid: 331c67f15523ad7419792662b9768f44
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存