using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class WaterCopeFire : MonoBehaviour { public bool IsWater; public float time; public float DurationTime = 180f; // Use this for initialization void Start() { DurationTime=float.Parse( TransformHelper.LoadJsonFromConfing("DurationTime.json")); } // Update is called once per frame void Update() { if (RecordEvent.IsReplay()) return; if (IsWater) { time += Time.deltaTime; if (time >= DurationTime) { time = 0; EntitiesManager.Instance.DeleteObj(gameObject); RecordEvent.AddEventData(GetComponent().gameObjType, RecordEventType.Delete, gameObject.name); } IsWater = false; } } private void OnParticleCollision(GameObject other) { if (other.layer != 4) return; IsWater = true; } }