后处理+FEEL完全改进
This commit is contained in:
@@ -8,14 +8,16 @@ namespace Cielonos.MainGame
|
||||
{
|
||||
public partial class HitSubmodule : AttackAreaSubmoduleBase
|
||||
{
|
||||
public int hitCount;
|
||||
public int originalHitCount;
|
||||
public int currentHitIndex;
|
||||
public float hitInterval;
|
||||
private float currentIntervalTime;
|
||||
|
||||
public List<GameObject> checkedObjects;
|
||||
public bool isAutoPlayHitSound;
|
||||
public List<string> hitSoundList;
|
||||
public List<Action<CharacterBase, Vector3>> hitEventList;
|
||||
public List<Action<CharacterBase, Vector3>> generalHitEventList;
|
||||
public SortedList<int, Action<CharacterBase, Vector3>> specificHitEventList;
|
||||
|
||||
public HitSubmodule(AttackAreaBase attackArea) : base(attackArea)
|
||||
{
|
||||
@@ -30,15 +32,17 @@ namespace Cielonos.MainGame
|
||||
}
|
||||
|
||||
private void InitializeAsOnceHit()
|
||||
{
|
||||
this.hitCount = 1;
|
||||
{
|
||||
this.originalHitCount = 1;
|
||||
this.currentHitIndex = 0;
|
||||
this.hitInterval = -1;
|
||||
this.currentIntervalTime = 0;
|
||||
}
|
||||
|
||||
private void InitializeAsMultipleHit(float hitInterval, int hitCount)
|
||||
{
|
||||
this.hitCount = hitCount;
|
||||
this.originalHitCount = hitCount;
|
||||
this.currentHitIndex = 0;
|
||||
this.hitInterval = hitInterval;
|
||||
this.currentIntervalTime = 0;
|
||||
}
|
||||
@@ -48,7 +52,8 @@ namespace Cielonos.MainGame
|
||||
isAutoPlayHitSound = true;
|
||||
checkedObjects = new List<GameObject>();
|
||||
hitSoundList = new List<string>();
|
||||
hitEventList = new List<Action<CharacterBase, Vector3>>();
|
||||
generalHitEventList = new List<Action<CharacterBase, Vector3>>();
|
||||
specificHitEventList = new SortedList<int, Action<CharacterBase, Vector3>>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +83,16 @@ namespace Cielonos.MainGame
|
||||
|
||||
public HitSubmodule AddHitEvent(Action<CharacterBase, Vector3> hitEvent)
|
||||
{
|
||||
hitEventList.Add(hitEvent);
|
||||
generalHitEventList.Add(hitEvent);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HitSubmodule AddHitEvent(Action<CharacterBase, Vector3> hitEvent, params int[] indexes)
|
||||
{
|
||||
foreach (int i in indexes)
|
||||
{
|
||||
specificHitEventList[i] = hitEvent;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -87,7 +101,7 @@ namespace Cielonos.MainGame
|
||||
{
|
||||
public void Update()
|
||||
{
|
||||
if (!isEnabling || hitCount <= 1 || attackArea.timeSm.delayTime > 0)
|
||||
if (!isEnabling || currentHitIndex >= originalHitCount - 1 || attackArea.timeSm.delayTime > 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -101,10 +115,10 @@ namespace Cielonos.MainGame
|
||||
//attackArea.attackSm.modifiedAttackValue = attackArea.attackSm.originalAttackValue;
|
||||
}
|
||||
currentIntervalTime -= hitInterval;
|
||||
hitCount--;
|
||||
currentHitIndex++;
|
||||
}
|
||||
|
||||
if (hitCount <= 0)
|
||||
if (currentHitIndex >= originalHitCount - 1)
|
||||
{
|
||||
attackArea.isEnabling = false;
|
||||
}
|
||||
@@ -126,10 +140,16 @@ namespace Cielonos.MainGame
|
||||
{
|
||||
if (attackArea.canTriggerHitEvent)
|
||||
{
|
||||
foreach (Action<CharacterBase, Vector3> hitEvent in hitEventList)
|
||||
foreach (Action<CharacterBase, Vector3> hitEvent in generalHitEventList)
|
||||
{
|
||||
hitEvent.Invoke(target, hitPosition);
|
||||
}
|
||||
|
||||
Debug.Log($"[HitSubmodule] Invoking specific hit event for hit index {currentHitIndex}.");
|
||||
if (specificHitEventList.ContainsKey(currentHitIndex))
|
||||
{
|
||||
specificHitEventList[currentHitIndex].Invoke(target, hitPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user