You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.4 KiB
79 lines
3.4 KiB
5 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using AX.Network.Protocols;
|
||
|
using UnityEngine;
|
||
|
using AX.Serialization;
|
||
|
using AX.InputSystem;
|
||
|
using UnityEngine.AI;
|
||
|
using AX.MessageSystem;
|
||
|
|
||
|
public class TRAPPED_GUIDANCE_SYNC : NetworkMessageBehaviour
|
||
|
{
|
||
|
private TrappedMoveFree trapped;
|
||
|
void Start()
|
||
|
{
|
||
|
trapped = GetComponent<TrappedMoveFree>();
|
||
|
}
|
||
|
protected override void Execute(BinaryMessage message)
|
||
|
{
|
||
|
InputHistory.Instance.RegisterInputHistory(message);
|
||
|
var info = message.Body.Deserialize<TrappedGuidanceSyncData>();
|
||
|
// var sender = info.SendUserID;
|
||
|
if (InputManager.Instance)
|
||
|
{
|
||
|
|
||
|
if (CurrentUserInfo.mySelf.Id != info.SendUserID)
|
||
|
{
|
||
|
if (info.gameObjID == GetComponent<BaseGameObjInfo>().gameObjID)
|
||
|
{
|
||
|
if (info.IsSetPoint == true)
|
||
|
{
|
||
|
if (trapped.MeetDangerous)
|
||
|
{
|
||
|
trapped.MeetDangerous = false;
|
||
|
}
|
||
|
trapped.CancelInvokeRandom();
|
||
|
trapped.Guidance = true;
|
||
|
trapped.IsSetPoint = true;
|
||
|
trapped.IsselfClient = false;
|
||
|
GetComponent<TrappedPathFind>().StopAllCoroutines();
|
||
|
GetComponent<NavMeshAgent>().SetDestination(transform.position);
|
||
|
trapped.targetPosition = transform.position;
|
||
|
trapped.movestate = MoveState.IDLE;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (info.IsEnd == false)
|
||
|
{
|
||
|
trapped.SaveFrirmanUserId = info.SaveFiremanUserID;
|
||
|
trapped.Guidance = true;
|
||
|
trapped.IsSetPoint = false;
|
||
|
trapped.guidPoint = info.Guidlist;
|
||
|
trapped.IsselfClient = false;
|
||
|
TrappedPathFindingCmdArgs arg = new TrappedPathFindingCmdArgs();
|
||
|
arg.hitPoint = info.Guidlist[0];
|
||
|
GetComponent<TrappedMoveFree>().targetPosition = arg.hitPoint;
|
||
|
//arg.gameObjID = GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
arg.gameObjIdSelf = GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
TrappedPathFindingCommand.Instance.Execute(GetComponent<BaseGameObjInfo>().gameObjID, arg);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
trapped.Guidance = false;
|
||
|
trapped.movestate = MoveState.IDLE;
|
||
|
GetComponent<TrappedPathFind>().StopAllCoroutines();
|
||
|
//GetComponent<NavMeshAgent>().enabled = false;
|
||
|
trapped.OverMoveOrGuidance = true;
|
||
|
//MessageDispatcher.SendMessage("SomeoneOutOfTrap"); //通知火场信息-疏散救生-被困时间部分更新,看是否可以停止计时
|
||
|
TrappedTime.CheckStopTime();
|
||
|
// GetComponent<Animator>().SetFloat("Speed", 0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|