using ColdMint.scripts.damage;
using Godot;
namespace ColdMint.scripts.furniture;
///
/// FurnitureTemplate
/// 家具模板
///
public partial class Furniture : RigidBody2D
{
[Export] private int _initialDurability;
[Export] private int _maxDurability;
///
///
/// 家具的耐久度
///
private int _durability;
public override void _Ready()
{
if (_maxDurability <= 0)
{
_maxDurability = Config.DefaultMaxDurability;
}
if (_initialDurability <= 0 || _initialDurability > _maxDurability)
{
_initialDurability = _maxDurability;
}
_durability = _initialDurability;
SetCollisionMaskValue(Config.LayerNumber.Wall, true);
SetCollisionMaskValue(Config.LayerNumber.Platform, true);
SetCollisionMaskValue(Config.LayerNumber.Floor, true);
}
public override void _PhysicsProcess(double delta)
{
if (Input.IsActionJustReleased("push"))
{
SetCollisionMaskValue(Config.LayerNumber.Player, false);
}
if (Input.IsActionJustPressed("push"))
{
SetCollisionMaskValue(Config.LayerNumber.Player, true);
}
}
///
/// This method is called when furniture is damaged
/// 当家具损害时调用此方法
///
///
///
///Return whether the damage completely destroyed the furniture
///返回本次伤害是否彻底破坏了家具
///
public bool Damage(DamageTemplate damageTemplate)
{
return false;
}
}