using System.IO;
|
using UnityEngine;
|
|
namespace H2Engine
|
{
|
[System.Serializable]
|
public class Evt_RefreshMonster : Evt
|
{
|
public enum E_OverCondition
|
{
|
DeadCount,
|
Time,
|
}
|
|
public enum E_RefreshType
|
{
|
All,
|
OneByOneTime,// 根据时间刷新
|
OneByOnePrevDie,// 前一只刷出已死亡
|
}
|
|
public MonsterData[] monsters;
|
public E_OverCondition overCondition = E_OverCondition.DeadCount;
|
public E_RefreshType refreshType = E_RefreshType.All;
|
/// <summary>
|
/// 参数
|
/// <para>当使用OverCondition类型为DeadCount的时候为个数</para>
|
/// <para>当使用OverCondition类型为Time的时候为时间(毫秒)</para>
|
/// </summary>
|
public int conditionParam;
|
/// <summary>
|
/// 刷新参数
|
/// <para>刷新类型: OneByOneTime, 作为时间(毫秒)</para>
|
/// </summary>
|
public int refreshParam;
|
public int nextEventID = -1;
|
|
public override void Load(BinaryReader br)
|
{
|
base.Load(br);
|
overCondition = (Evt_RefreshMonster.E_OverCondition)br.ReadByte();
|
refreshType = (Evt_RefreshMonster.E_RefreshType)br.ReadByte();
|
refreshParam = br.ReadInt32();
|
conditionParam = br.ReadInt32();
|
nextEventID = br.ReadInt32();
|
int _count = br.ReadInt32();
|
monsters = new MonsterData[_count];
|
for (int i = 0; i < _count; ++i)
|
{
|
monsters[i] = new MonsterData();
|
monsters[i].Load(br);
|
}
|
}
|
|
/*
|
float delay = Time.now
|
float interval
|
int index
|
|
update
|
if refreshType == all
|
for index = 0; index < monsters.Length; ++index
|
doRefresh(monsters[index]);
|
else if refreshType == onebyoneTime
|
if Time.now - delay > interval
|
doRefresh(monster[index]);
|
index++;
|
delay = Time.now;
|
else if refreshType == onebyoneDie
|
if prevNpc.isDie
|
prevNpc = doRefresh(monster[index]);
|
index++;
|
|
int deadCount
|
float overTime = conditionParam * 0.001f;
|
float timePast = Time.now
|
|
over
|
if condition == None
|
return true;
|
else if condition == DeadCount
|
return deadCount > monsters.Length || deadCount > conditionParam;
|
else if condition == Time
|
return Time.now - timePast >= overTime;
|
*/
|
}
|
}
|