54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
|
using GCGame.Table;
|
|||
|
using Module.Log;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 模型缩放客户端表现效果
|
|||
|
/// Effect.txt 表格扩展参数说明
|
|||
|
/// Param1 :缩放开始数值
|
|||
|
/// Param2 :缩放结束数值
|
|||
|
/// Param3 :缩放动画时间
|
|||
|
/// </summary>
|
|||
|
public class Impact_ModelScale : ImpactEffectBase
|
|||
|
{
|
|||
|
private float _endSize;
|
|||
|
private float _scaleTime;
|
|||
|
private float _startSize;
|
|||
|
|
|||
|
public override EffectLogic.EffectType ImpactEffectType
|
|||
|
{
|
|||
|
get { return EffectLogic.EffectType.TYPE_SCALE; }
|
|||
|
}
|
|||
|
|
|||
|
// Hack重用ChangeMatPro类型。直接添加SetRatio的接口,不走Update流程来控制当前实际效果
|
|||
|
public override void StartEffect()
|
|||
|
{
|
|||
|
base.StartEffect();
|
|||
|
if (objCharacter != null && Data != null)
|
|||
|
{
|
|||
|
var start = Data.GetParamValuebyIndex(0);
|
|||
|
var end = Data.GetParamValuebyIndex(1);
|
|||
|
var time = Data.GetParamValuebyIndex(2);
|
|||
|
_startSize = start > 0 ? start * 0.01f : 1f;
|
|||
|
_endSize = end > 0 ? end * 0.01f : 1f;
|
|||
|
_scaleTime = time.ToClientTime();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected override void UpdateInherited()
|
|||
|
{
|
|||
|
base.UpdateInherited();
|
|||
|
if (objCharacter != null)
|
|||
|
if (startTime + _scaleTime < Time.time || _scaleTime <= 0f)
|
|||
|
objCharacter.SetModelScale(_endSize);
|
|||
|
else
|
|||
|
objCharacter.SetModelScale(Mathf.Lerp(_startSize, _endSize, (Time.time - startTime) / _scaleTime));
|
|||
|
}
|
|||
|
|
|||
|
public override void StopEffect()
|
|||
|
{
|
|||
|
base.StopEffect();
|
|||
|
if (objCharacter != null)
|
|||
|
objCharacter.ResetModelScale();
|
|||
|
}
|
|||
|
}
|