using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class BoiloverData : RecordObjectBase
{
    public string name;
    public bool catchFire;
    public Vector3 bottomScale;
    public Vector3 boxsize;
    public float nowScale;
    public float shapRadius;
}
public class BoiloverControl : MonoBehaviour
{
    public bool CatchFire;
    void Start()
    {

    }
    private void Update()
    {
        if (CatchFire)
        {
            if (!transform.Find("StreamFire").gameObject.activeSelf)
            {
                transform.Find("StreamFire").gameObject.SetActive(true);
            }
            if (!transform.Find("FireBottom").gameObject.activeSelf)
            {
                transform.Find("FireBottom").gameObject.SetActive(true);
            }
        }
    }
    public void GetBoiloverData(BoiloverData data)
    {
        data.name = gameObject.name;
        data.boxsize = GetComponent<BoxCollider>().size;
        data.bottomScale = transform.Find("BottomOil").transform.localScale;
        data.nowScale = transform.Find("BottomOil").GetComponent<OilSpread>().ranyouScale;
        data.shapRadius = transform.Find("FireBottom").GetComponent<OilParticleControl>().NowShape;
        data.catchFire = CatchFire;
    }
    public void SetBoiloverData(BoiloverData data)
    {
        GetComponent<BoxCollider>().size = data.boxsize;
        transform.Find("BottomOil").transform.localScale = data.bottomScale;
        transform.Find("BottomOil").GetComponent<OilSpread>().ranyouScale = data.nowScale;
        transform.Find("FireBottom/fire (8)").GetComponent<OilParticleControl>().NowShape = data.shapRadius;
        transform.Find("FireBottom").GetComponent<OilParticleControl>().NowShape = data.shapRadius;
        CatchFire = data.catchFire;
    }
}