备份CatanBuilding瘦身独立工程
This commit is contained in:
95
Assets/Scripts/EventWashing/Stuff/StuffUnloadGlass.cs
Normal file
95
Assets/Scripts/EventWashing/Stuff/StuffUnloadGlass.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace game
|
||||
{
|
||||
public class StuffUnloadGlass : StuffUnload
|
||||
{
|
||||
[Tooltip("循环特效时间")]
|
||||
[SerializeField]
|
||||
private float m_LoopTime = 1.0f;
|
||||
|
||||
[Tooltip("最后一击特效时间")]
|
||||
[SerializeField]
|
||||
private float m_FinalBlowTime = 0.3f;
|
||||
|
||||
#region 外部接口
|
||||
public override void StopAction()
|
||||
{
|
||||
base.StopAction();
|
||||
|
||||
Exit1stStage();
|
||||
Exit2ndStage();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 状态&内部使用
|
||||
private bool m_IsRunning2rd = false;
|
||||
private void Enter2ndStage()
|
||||
{
|
||||
if (m_IsRunning2rd) return;
|
||||
m_IsRunning2rd = true;
|
||||
|
||||
FishingYachtAct.Publish<EventWashingToolEnter2ndStageData>(new EventWashingToolEnter2ndStageData());
|
||||
}
|
||||
private void Exit2ndStage()
|
||||
{
|
||||
if (m_IsRunning2rd == false) return;
|
||||
m_IsRunning2rd = false;
|
||||
FishingYachtAct.Publish<EventWashingToolExit2ndStageData>(new EventWashingToolExit2ndStageData());
|
||||
}
|
||||
|
||||
private bool m_IsRunning1st = false;
|
||||
private void Enter1stStage()
|
||||
{
|
||||
if (m_IsRunning1st) return;
|
||||
m_IsRunning1st = true;
|
||||
FishingYachtAct.Publish<EventWashingToolEnter1stStageData>(new EventWashingToolEnter1stStageData());
|
||||
}
|
||||
private void Exit1stStage()
|
||||
{
|
||||
if (m_IsRunning1st == false) return;
|
||||
m_IsRunning1st = false;
|
||||
FishingYachtAct.Publish<EventWashingToolExit1stStageData>(new EventWashingToolExit1stStageData());
|
||||
}
|
||||
protected override void UpdateState()
|
||||
{
|
||||
if (m_Status == EventWashingActionStatus.Executing)
|
||||
{
|
||||
m_CumulativeTime += Time.deltaTime;
|
||||
if (m_CumulativeTime >= m_ConsumeTime)
|
||||
{
|
||||
Exit2ndStage();
|
||||
m_CumulativeTime = m_ConsumeTime;
|
||||
m_Status = EventWashingActionStatus.Ending;
|
||||
if (m_OverAction != null)
|
||||
{
|
||||
m_OverAction.Invoke(this);
|
||||
}
|
||||
}
|
||||
else if (m_CumulativeTime > m_LoopTime)
|
||||
{
|
||||
Exit1stStage();
|
||||
Enter2ndStage();
|
||||
}
|
||||
else if (m_CumulativeTime >= 0f)
|
||||
{
|
||||
Enter1stStage();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 生命周期
|
||||
public override void InitStuff()
|
||||
{
|
||||
base.InitStuff();
|
||||
m_Type = EventWashingStuffType.UnloadGlass;
|
||||
|
||||
m_ConsumeTime = m_LoopTime + m_FinalBlowTime;
|
||||
StopAction();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user