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.
48 lines
1.3 KiB
48 lines
1.3 KiB
using AX.MessageSystem; |
|
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
[Serializable] |
|
public class SmokeRecordData : RecordObjectBase |
|
{ |
|
public string name; |
|
public int value;//浓度 |
|
} |
|
public class SmokeControl : ObjDoubleClick |
|
{ |
|
public ParticleSystem.MainModule MySmokeMain; |
|
private void Awake() |
|
{ |
|
MySmokeMain = GetComponentInChildren<ParticleSystem>().main; |
|
} |
|
public void Start() |
|
{ |
|
MessageDispatcher.AddListener("ReplayEvent", ReplayEventNongDu); |
|
} |
|
private void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("ReplayEvent", ReplayEventNongDu); |
|
} |
|
private void ReplayEventNongDu(IMessage obj) |
|
{ |
|
var eventData = (EventData)obj.Data; |
|
if (eventData.eventType == RecordEventType.SmokeNormal |
|
|| eventData.eventType == RecordEventType.SmokeInside) |
|
{ |
|
SmokeSettingData data = JsonUtility.FromJson<SmokeSettingData>(eventData.json); |
|
if (data.name == gameObject.name) |
|
{ |
|
MySmokeMain.maxParticles = data.value * 10; |
|
} |
|
} |
|
|
|
} |
|
|
|
public override void ClickFunc() |
|
{ |
|
base.ClickFunc(); |
|
SmokePanel.GetActiveInstance.SetNongDu(gameObject, MySmokeMain.maxParticles / 10); |
|
} |
|
}
|
|
|