123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- using System;
- using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
- using Fort23.Core;
- using Fort23.UTool;
- using UnityEngine;
- using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
- namespace GameLogic.Combat.Buff
- {
- public class BuffBasic : CObject
- {
- protected CombatHeroEntity combatHeroEntity;
- public BuffInfo buffInf;
- protected CombatHeroEntity source;
- protected TriggerData _triggerData;
- public float _currTime;
- public int buffCount
- {
- get { return _count; }
- }
- protected int _count;
- public void Init(CombatHeroEntity combatHeroEntity, CombatHeroEntity source, BuffInfo buffInfo)
- {
- this.combatHeroEntity = combatHeroEntity;
- this.buffInf = buffInfo;
- this.source = source;
- ProInit();
- AddBuffCount(source, buffInfo);
- }
- public void AddBuffCount(CombatHeroEntity source, BuffInfo buffInfo)
- {
- _currTime = 0;
- int c = buffCount + buffInfo.count;
- if (c > buffInfo.BuffConfig.overlayCount)
- {
- c = buffInfo.BuffConfig.overlayCount - buffCount;
- }
- else
- {
- c = buffInfo.count;
- }
- if (c <= 0)
- {
- return;
- }
- _count += c;
- UpdateEffect();
- }
- protected virtual void ProInit()
- {
- }
- public override void ActiveObj()
- {
- }
- public void UpdateEffect()
- {
- ProUpdateEffect();
- }
- protected virtual void ProUpdateEffect()
- {
- }
- public void ReduceCount(int count)
- {
- _count -= count;
- if (_count <= 0)
- {
- combatHeroEntity.BuffControl.RemoveBuff(this);
- return;
- }
- UpdateEffect();
- }
- public TimeLineEventLogicGroupBasic ActivationTimeLineData(string groupName,
- BetterList<ILifetCycleHitPoint> currTarget = null,
- Vector3[] customizePos = null, System.Action finishCallBack = null, float startTime = default,
- object extraData = null, int indexCount = 0)
- {
- TimeLineEventLogicGroupBasic timeLineEventLogicGroup =
- source.combatHeroTimeLineControl
- .GetTimeLineEventLogicGroup<TimeLineEventLogicGroupBasic>(groupName, null);
- try
- {
- if (timeLineEventLogicGroup != null)
- {
- timeLineEventLogicGroup.extraData = extraData;
- timeLineEventLogicGroup.SetCombatInfo(combatHeroEntity, null, currTarget, _triggerData,
- customizePos, indexCount);
- timeLineEventLogicGroup.TimeLineUpdateEnd = finishCallBack;
- timeLineEventLogicGroup.timeLineTime = startTime;
- combatHeroEntity.combatHeroTimeLineControl.AddEventLogicGroup(timeLineEventLogicGroup);
- // currUseAllTimeLineLogic.Add(timeLineEventLogicGroup);
- }
- }
- catch (Exception e)
- {
- LogTool.Error(e);
- }
- return timeLineEventLogicGroup;
- }
- public override void DormancyObj()
- {
- _currTime = 0;
- ProDormancyObj();
- CObjectPool.Instance.Recycle(buffInf);
- buffInf = null;
- combatHeroEntity = null;
- }
- protected virtual void ProDormancyObj()
- {
- }
- public void Update(float t)
- {
- _currTime += t;
- if (buffInf.buffTime > 0 && _currTime > buffInf.buffTime)
- {
- combatHeroEntity.BuffControl.RemoveBuff(this);
- return;
- }
- ProUpdate(t);
- }
- protected virtual void ProUpdate(float t)
- {
- }
- }
- }
|