file refactor
This commit is contained in:
parent
da5a3e874b
commit
bffb012a26
175 changed files with 1086 additions and 1107 deletions
|
|
@ -1,36 +0,0 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
public partial class FlashComponent : CanvasGroup
|
||||
{
|
||||
[Export] private float _flashDuration = 0.1f;
|
||||
private Tween _tween;
|
||||
private ShaderMaterial _shaderMaterial;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_shaderMaterial = Material as ShaderMaterial;
|
||||
}
|
||||
|
||||
public void DamageFlash(int damage,Node origin)
|
||||
{
|
||||
Flash();
|
||||
}
|
||||
|
||||
|
||||
public void Flash()
|
||||
{
|
||||
_tween?.Kill();
|
||||
_tween = CreateTween();
|
||||
|
||||
Action<float> action = SetAmount;
|
||||
_tween.TweenMethod(Callable.From(action),0.8f,0.0f,_flashDuration);
|
||||
}
|
||||
|
||||
private void SetAmount(float amount)
|
||||
{
|
||||
_shaderMaterial.SetShaderParameter("amount",amount);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue