42 lines
1012 B
C#
42 lines
1012 B
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using Godot;
|
|
|
|
namespace Zennysoft.Game.Ma;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
public partial class EnemyModelView3D : EnemyModelView
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
[Node] protected AnimationPlayer _animationPlayer { get; set; } = default!;
|
|
|
|
[Node] public MeshInstance3D MeshInstance { get; set; } = default!;
|
|
|
|
private void ChangeMaterial()
|
|
{
|
|
var material = new StandardMaterial3D
|
|
{
|
|
AlbedoColor = Color.FromHsv(0, 1, 1, 1)
|
|
};
|
|
MeshInstance.MaterialOverride = (Material)material.Duplicate();
|
|
}
|
|
|
|
private void LoadShader(string shaderPath)
|
|
{
|
|
var shader = GD.Load<ShaderMaterial>(shaderPath);
|
|
MeshInstance.MaterialOverride = shader;
|
|
}
|
|
|
|
private void ClearDamageEffect()
|
|
{
|
|
MeshInstance.MaterialOverride = null;
|
|
MeshInstance.Transparency = 0;
|
|
}
|
|
|
|
private void SetTransparency(float transparencyAmount)
|
|
{
|
|
MeshInstance.Transparency = transparencyAmount;
|
|
}
|
|
}
|