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.
52 lines
2.2 KiB
52 lines
2.2 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class ReplayBlizzardCannon : ReplaySimpleObject
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 回放克隆
|
||
|
/// </summary>
|
||
|
/// <param name="json"></param>
|
||
|
public override void CloneObject(string json)
|
||
|
{
|
||
|
var jsonData = JsonUtility.FromJson<RecordBlizzardCannon>(json);
|
||
|
var clonedObj = EntitiesManager.Instance.CreateObj(cloneBase.clonePrefab, jsonData.myTransform.getMyPosition(), transform, long.Parse(jsonData.objectName));
|
||
|
clonedObj.name = jsonData.objectName;//名字即ID
|
||
|
SetBlizzardCannon(clonedObj, jsonData);
|
||
|
SetCloneGameObject(clonedObj, json);
|
||
|
if (clonedObj.GetComponent<ObjSelectCtrl>())
|
||
|
{
|
||
|
clonedObj.GetComponent<ObjSelectCtrl>().SetSelect(json);
|
||
|
}
|
||
|
if (clonedObj.GetComponent<ObjDrag>())
|
||
|
{
|
||
|
clonedObj.GetComponent<ObjDrag>().enabled = jsonData.dragable;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 设置基本属性
|
||
|
/// </summary>
|
||
|
/// <param name="clonedObj"></param>
|
||
|
/// <param name="jsonData"></param>
|
||
|
public void SetBlizzardCannon(GameObject clonedObj, RecordBlizzardCannon jsonData)
|
||
|
{
|
||
|
clonedObj.name = jsonData.objectName;
|
||
|
clonedObj.transform.localRotation = jsonData.myTransform.getMyRotation();
|
||
|
clonedObj.transform.localPosition = jsonData.myTransform.getMyPosition();
|
||
|
clonedObj.transform.localScale = jsonData.myTransform.getMyScale();
|
||
|
SelectedObjs.gameObjs.Add(clonedObj);
|
||
|
|
||
|
CloneGameObjInfo objMsg = clonedObj.GetComponent<CloneGameObjInfo>();
|
||
|
objMsg.gameObjType = jsonData.gameObjType;
|
||
|
objMsg.buildNum = jsonData.buildNum;
|
||
|
objMsg.floorNum = jsonData.floorNum;
|
||
|
objMsg.interlayerNum = jsonData.interlayerNum;
|
||
|
clonedObj.transform.Find("paokou").localEulerAngles = jsonData.headRotation;
|
||
|
clonedObj.GetComponent<WaterReceiver>().hasSupplier = jsonData.hasSupplier;
|
||
|
clonedObj.SetActive(jsonData.isActive);
|
||
|
clonedObj.GetComponent<ToolAttribute>().ReplayTask(jsonData.task);
|
||
|
clonedObj.GetComponent<BlizzardCannonControl>().SetWaterScale(jsonData.waterScale);
|
||
|
}
|
||
|
}
|