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.
86 lines
3.6 KiB
86 lines
3.6 KiB
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<BaseGameObjInfo>(); |
|
} |
|
protected override void Execute(BinaryMessage message) |
|
{ |
|
InputHistory.Instance.RegisterInputHistory(message); |
|
|
|
var info = message.Body.Deserialize<WounderMoveSyncData>(); |
|
// var sender = info.SendUserID; |
|
if (InputManager.Instance) |
|
{ |
|
if (CurrentUserInfo.mySelf.Id != info.SendUserID) |
|
{ |
|
long saveId = EntitiesManager.Instance.GetEntityByID(info.Fireman1Id).GetComponent<BaseGameObjInfo>().UserID; |
|
if (baseinfo.gameObjID==info.WounderId) |
|
{//伤员处理 |
|
GetComponent<BaseHaemalController>().IsMoving = info.IsBegianMove; |
|
|
|
if (GetComponent<TrappedMoveFree>()) |
|
{ |
|
GetComponent<TrappedMoveFree>().OverMoveOrGuidance = true; |
|
TrappedTime.CheckStopTime(); |
|
//GetComponent<NavMeshAgent>().SetDestination(transform.position); |
|
|
|
//GetComponent<TrappedPathFind>().pathFindEnable = false; |
|
GetComponent<NavMeshAgent>().baseOffset = 0.2f; |
|
GetComponent<TrappedMoveFree>().SaveFrirmanUserId = saveId; |
|
transform.position = info.WounderPos; |
|
GetComponent<TrappedMoveFree>().targetPosition = transform.position; |
|
GetComponent<TrappedPathFind>().StopAllCoroutines(); |
|
GetComponent<TrappedPathFind>().enabled = false; |
|
GetComponent<NavMeshAgent>().enabled = false; |
|
//transform.position = transform.position + Vector3.up; |
|
} |
|
if(GetComponent<WoundedSave>()) |
|
{ |
|
transform.position = info.WounderPos; |
|
GetComponent<WoundedSave>().OverMoveOrGuidance = true; |
|
GetComponent<WoundedSave>().SaveFrirmanUserId = saveId; |
|
TrappedTime.CheckStopTime(); |
|
} |
|
} |
|
//消防员处理 |
|
if(baseinfo.gameObjID==info.Fireman1Id) |
|
{ |
|
transform.position = info.Fireman1Pos; |
|
// GetComponent<NavMeshAgent>().SetDestination(transform.position); |
|
GetComponent<AgentController>().StopAllCoroutines(); |
|
GetComponent<AgentController>().enabled = false; |
|
GetComponent<NavMeshAgent>().enabled = false; |
|
StartCoroutine(OpNav()); |
|
} |
|
if (baseinfo.gameObjID==info.Fireman2Id) |
|
{ |
|
transform.position = info.Fireman2Pos; |
|
//GetComponent<NavMeshAgent>().SetDestination(transform.position); |
|
GetComponent<AgentController>().StopAllCoroutines(); |
|
GetComponent<AgentController>().enabled = false; |
|
GetComponent<NavMeshAgent>().enabled = false; |
|
StartCoroutine(OpNav()); |
|
} |
|
|
|
} |
|
} |
|
} |
|
IEnumerator OpNav() |
|
{ |
|
yield return new WaitForSeconds(0.5f); |
|
GetComponent<NavMeshAgent>().enabled = true; |
|
} |
|
|
|
|
|
}
|
|
|