using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireManReplay : ReplaySimpleObject
{
public GameObject nullobject;
public Transform p_Drawline;
public override void Start()
{
base.Start();
nullobject = Resources.Load("Prefab/nullobject") as GameObject;
p_Drawline = GameObject.Find("P_DrawLine").transform;
}
///
/// 设置特殊属性
///
///
public override void SetCloneGameObject(GameObject obj, string json)
{
//ClearpDraw();
// CreatLineParent(obj);
// Debug.Log(obj.name);
if (!obj.GetComponent())
obj.AddComponent();
if (!obj.GetComponent())
obj.AddComponent();
if (obj.GetComponent())
{
obj.GetComponent().DelectAllLine();
}
SelectedObjs.characters.Add(obj);
var jsonData = JsonUtility.FromJson(json);
var PowerAttribute = obj.GetComponent();
PowerAttribute.Task = jsonData.Task;
PowerAttribute.Affiliation = jsonData.Affiliation;
PowerAttribute.Number = jsonData.Number;
PowerAttribute.TypeName = jsonData.TypeName;
var RecordDiverseDatas = GetComponents();
foreach (IReplayDiverseData item in RecordDiverseDatas)
{
item.ReplayDiverseData(jsonData.SpecialData, obj);
}
}
public void CreatLineParent(GameObject game)
{
if (!GameObject.Find("drawline-" + game.name))
{
GameObject pline = Instantiate(nullobject, p_Drawline);
pline.name = "drawline-" + game.name;
pline.transform.parent = p_Drawline;
}
}
public void ClearpDraw()
{
if (p_Drawline.childCount>0)
{
for (int i = 0; i < p_Drawline.childCount; i++)
{
Destroy(p_Drawline.GetChild(i).gameObject);
}
}
}
}