浏览代码

Addressing comments

- added target id to the revive action
 - caught an error in istargetingnpc check - it was actually checking for PCs
 - removed sanity check from ActionPlayer - it shouldn't be needed and actions should be prevented from entereing the queue with other means.
/main
Philipp Deschain 4 年前
当前提交
c90c2c46
共有 2 个文件被更改,包括 8 次插入11 次删除
  1. 13
      Assets/BossRoom/Scripts/Client/ClientInputSender.cs
  2. 6
      Assets/BossRoom/Scripts/Server/Game/Action/ActionPlayer.cs

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


[RequireComponent(typeof(NetworkCharacterState))]
public class ClientInputSender : NetworkedBehaviour
{
private static readonly int NPCLayerMask = LayerMask.GetMask("NPCs");
private NetworkCharacterState m_NetworkCharacter;
/// <summary>

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.

//if we have clicked on an enemy:
// - two actions will queue one after the other, causing us to run over to our target and take a swing.
//if we have clicked on a fallen friend - we will revive him
chase_data.TargetIds = new ulong[] { GetTargetObject(ref hit) };
chase_data.TargetIds = new ulong[] {GetTargetObject(ref hit)};
bool isTargetingNPC = hit.transform.gameObject.layer == LayerMask.GetMask("PCs");
bool isTargetingNPC = hit.transform.gameObject.layer == NPCLayerMask;
if (isTargetingNPC)
{
var hit_data = new ActionRequestData();

var revive_data = new ActionRequestData();
revive_data.ShouldQueue = true;
revive_data.ActionTypeEnum = ActionType.GENERAL_REVIVE;
revive_data.TargetIds = new [] {GetTargetObject(ref hit)};
m_NetworkCharacter.ClientSendActionRequest(ref revive_data);
}
}

6
Assets/BossRoom/Scripts/Server/Game/Action/ActionPlayer.cs


public void PlayAction(ref ActionRequestData data )
{
//sanity check that prevents dead or fainted characters from executing actions
if (m_parent.NetState.NetworkLifeState.Value != LifeState.ALIVE)
{
return;
}
if( !data.ShouldQueue )
{
ClearActions();

正在加载...
取消
保存