mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 06:25:54 +00:00
Changed player to new one
This commit is contained in:
parent
60ab375572
commit
1c1436a539
27 changed files with 323 additions and 87 deletions
|
|
@ -16,21 +16,33 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
|
||||
[ExportCategory("Animation Names")]
|
||||
[Export]
|
||||
public string WalkRightAnimationName {get; private set;} = "walk_right";
|
||||
public StringName WalkRightAnimationName {get; private set;} = "walk_right";
|
||||
|
||||
[Export]
|
||||
public string WalkLeftAnimationName {get; private set;} = "walk_left";
|
||||
public StringName WalkLeftAnimationName {get; private set;} = "walk_left";
|
||||
[Export]
|
||||
public string WalkDownAnimationName {get; private set;} = "walk_down";
|
||||
public StringName WalkDownAnimationName {get; private set;} = "walk_down";
|
||||
[Export]
|
||||
public string WalkUpAnimationName {get; private set;} = "walk_up";
|
||||
public StringName WalkUpAnimationName {get; private set;} = "walk_up";
|
||||
|
||||
[ExportCategory("Shaders")]
|
||||
[Export] public ShaderMaterial BlinkMaterial {get; private set;}
|
||||
|
||||
[Export] public StringName BlinkShaderPropertyName { get; private set; } = new StringName("blink_intensity");
|
||||
[Export] public StringName BlinkShaderPropertyName { get; private set; } = new("blink_intensity");
|
||||
[Export] public StringName TeleportProgressPropertyName { get; private set; } = new("teleport_progress");
|
||||
[Export] public StringName ScanlineDensityPropertyName { get; private set; } = new("scanline_density");
|
||||
|
||||
private GTween _blinkTween;
|
||||
|
||||
public void ShowSprite()
|
||||
{
|
||||
_animatedSprite.Show();
|
||||
}
|
||||
|
||||
public void HideSprite()
|
||||
{
|
||||
_animatedSprite.Hide();
|
||||
}
|
||||
|
||||
public void SetAnimation(Vector2 velocity)
|
||||
{
|
||||
|
|
@ -78,6 +90,38 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
public void PlayTeleportAnimation()
|
||||
{
|
||||
if (BlinkMaterial == null) return;
|
||||
_animatedSprite.Material = BlinkMaterial;
|
||||
var material = ((ShaderMaterial)_animatedSprite.Material);
|
||||
_blinkTween?.Kill();
|
||||
_blinkTween = GTweenSequenceBuilder.New()
|
||||
.Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 0f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,50f,0.5f))
|
||||
.Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f,0.5f))
|
||||
.Build();
|
||||
|
||||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
public void PlayUnteleportAnimation()
|
||||
{
|
||||
if (BlinkMaterial == null) return;
|
||||
_animatedSprite.Material = BlinkMaterial;
|
||||
var material = ((ShaderMaterial)_animatedSprite.Material);
|
||||
_blinkTween?.Kill();
|
||||
_blinkTween = GTweenSequenceBuilder.New()
|
||||
.Append(material.TweenPropertyFloat(TeleportProgressPropertyName, 1f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName, 50f, 0f))
|
||||
.Append(material.TweenPropertyFloat(ScanlineDensityPropertyName,0f,0.5f))
|
||||
.Join(material.TweenPropertyFloat(TeleportProgressPropertyName, 0f,0.5f))
|
||||
.Build();
|
||||
|
||||
_blinkTween.Play();
|
||||
}
|
||||
|
||||
private void SetShaderTeleportProgress(float value)
|
||||
{
|
||||
((ShaderMaterial)_animatedSprite.Material).SetShaderParameter("teleport_progress", value);
|
||||
|
|
@ -103,4 +147,6 @@ public partial class PlayerAnimationProvider : Node2D
|
|||
{
|
||||
_shieldParticles.Emitting = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue