网演高层钦州
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.
 
 
 

53 lines
2.3 KiB

using System.Collections;
using System.Collections.Generic;
using AX.InputSystem;
using AX.MessageSystem;
using AX.NetworkSystem;
using UnityEngine;
public class CloneFireman : CloneBase
{
public override void Execute(IMessage obj)
{
var gameObjID = (long)obj.Sender;
var data = ((CloneCmdArgs)obj.Data);
if (data.cloneObjType == cloneObjType)
{
var hitPoint = data.hitPos;
Vector3 clonedObjPos = new Vector3(hitPoint.x, hitPoint.y, hitPoint.z);
//
var clonedObj = EntitiesManager.Instance.CreateObj(clonePrefab, clonedObjPos, transform, gameObjID);
clonedObj.name = CloneObjNameTool.Instance().GetCloneObjectName(cloneObjType);
//添加消防员可选中状态
SelectedObjs.characters.Add(clonedObj);
TheHeadName.GetInstance.CreateName(clonedObj.GetComponent<CloneGameObjInfo>().gameObjID,clonedObj.name,cloneObjType.ToString(), 20, Vector3.up * 3f);
//设置克隆物体所在楼层等基本属性,属性从点击的对象上获取
GameObject go = SelectedObjs.selectedObj;
//获取车的选中信息
CloneGameObjInfo CarInfo = go.GetComponent<CloneGameObjInfo>();
//消防员的信息
CloneGameObjInfo cloneObjInfo = clonedObj.GetComponent<CloneGameObjInfo>();
cloneObjInfo.gameObjType = cloneObjType;
cloneObjInfo.UserID = CurrentUserInfo.mySelf.Id;
cloneObjInfo.buildNum = CarInfo.buildNum;
cloneObjInfo.floorNum = CarInfo.floorNum;
cloneObjInfo.interlayerNum = CarInfo.interlayerNum;
// 记录消防员
EquipManager.Instance.AddClientFireMans(clonedObj);
//同步克隆
CloneSyncPersonData cloneData = new CloneSyncPersonData()
{
BuildNum = cloneObjInfo.buildNum,
CloneID = gameObjID,
CloneName = clonedObj.name,
ClonePosition = clonedObjPos,
CloneType = cloneObjType,
FloorNum = cloneObjInfo.floorNum,
InterLayerNum = cloneObjInfo.interlayerNum,
UserID = cloneObjInfo.UserID
};
NetworkManager.Default.SendAsync("CLONE_PERSON_SYNC", cloneData);
}
}
}