26 lines
659 B
C#
26 lines
659 B
C#
using Godot;
|
|
using Newlon.Components.Level;
|
|
using Newlon.Resources;
|
|
|
|
namespace Newlon.Components.Plants;
|
|
|
|
//
|
|
// Data that plant stores during runtime
|
|
//
|
|
|
|
public partial class RuntimePlantData : Entity
|
|
{
|
|
public int Line { get; set; }
|
|
public PlantResource Resource;
|
|
private AudioStream eatenSound = ResourceLoader.Load<AudioStream>("res://assets/audio/sfx/gulp.mp3");
|
|
public override void KillByDamage()
|
|
{
|
|
AudioSequencer.Play("plant_eaten", eatenSound);
|
|
base.KillByDamage();
|
|
}
|
|
public override void Kill()
|
|
{
|
|
PoolContainer.Instance.RemoveEntity(GlobalPosition, Resource.Layer);
|
|
QueueFree();
|
|
}
|
|
}
|