using System; using System.Collections; using System.Collections.Generic; using AX.Network.Protocols; using UnityEngine; using AX.Serialization; using UnityEngine.AI; //重伤员移动 public class WOUNDER_MOVE_SYNC : NetworkMessageBehaviour { private BaseGameObjInfo baseinfo; void Start() { baseinfo = GetComponent(); } protected override void Execute(BinaryMessage message) { InputHistory.Instance.RegisterInputHistory(message); var info = message.Body.Deserialize(); // var sender = info.SendUserID; if (InputManager.Instance) { if (CurrentUserInfo.mySelf.Id != info.SendUserID) { long saveId = EntitiesManager.Instance.GetEntityByID(info.Fireman1Id).GetComponent().UserID; if (baseinfo.gameObjID==info.WounderId) {//伤员处理 GetComponent().IsMoving = info.IsBegianMove; if (GetComponent()) { GetComponent().OverMoveOrGuidance = true; TrappedTime.CheckStopTime(); //GetComponent().SetDestination(transform.position); //GetComponent().pathFindEnable = false; GetComponent().baseOffset = 0.2f; GetComponent().SaveFrirmanUserId = saveId; transform.position = info.WounderPos; GetComponent().targetPosition = transform.position; GetComponent().StopAllCoroutines(); GetComponent().enabled = false; GetComponent().enabled = false; //transform.position = transform.position + Vector3.up; } if(GetComponent()) { transform.position = info.WounderPos; GetComponent().OverMoveOrGuidance = true; GetComponent().SaveFrirmanUserId = saveId; TrappedTime.CheckStopTime(); } } //消防员处理 if(baseinfo.gameObjID==info.Fireman1Id) { transform.position = info.Fireman1Pos; // GetComponent().SetDestination(transform.position); GetComponent().StopAllCoroutines(); GetComponent().enabled = false; GetComponent().enabled = false; StartCoroutine(OpNav()); } if (baseinfo.gameObjID==info.Fireman2Id) { transform.position = info.Fireman2Pos; //GetComponent().SetDestination(transform.position); GetComponent().StopAllCoroutines(); GetComponent().enabled = false; GetComponent().enabled = false; StartCoroutine(OpNav()); } } } } IEnumerator OpNav() { yield return new WaitForSeconds(0.5f); GetComponent().enabled = true; } }