Almanach
This commit is contained in:
parent
008fa31dd4
commit
b932e82555
39 changed files with 575 additions and 78 deletions
|
|
@ -7,7 +7,7 @@ namespace Newlon.Components.Level;
|
|||
public partial class PlantField : Node2D
|
||||
{
|
||||
private Node2D _plantSetter;
|
||||
private PlantResource _resource;
|
||||
private DisplayResource _resource;
|
||||
private Seedpacket _slot;
|
||||
private bool _previousCanPlace;
|
||||
private ChannelPlayer player;
|
||||
|
|
@ -21,18 +21,18 @@ public partial class PlantField : Node2D
|
|||
player = GetNode<ChannelPlayer>("PlantPlayer");
|
||||
}
|
||||
|
||||
public void SetPlant(Seedpacket slot, PlantResource plant)
|
||||
public void SetPlant(Seedpacket slot, DisplayResource resource)
|
||||
{
|
||||
_resource = plant;
|
||||
_resource = resource;
|
||||
_slot = slot;
|
||||
if (plant == null)
|
||||
if (resource == null)
|
||||
{
|
||||
foreach(var child in _plantSetter.GetChildren())
|
||||
child.QueueFree();
|
||||
}
|
||||
else
|
||||
{
|
||||
var scene = plant.Scene.Instantiate<Node2D>();
|
||||
var scene = resource.Scene.Instantiate<Node2D>();
|
||||
_plantSetter.AddChild(scene);
|
||||
scene.UseParentMaterial = true;
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ public partial class PlantField : Node2D
|
|||
var plant = _resource.Scene.Instantiate<RuntimePlantData>();
|
||||
PoolContainer.Instance.Plants.AddChild(plant);
|
||||
plant.GlobalPosition = (_plantSetter.GlobalPosition / Utility.Tile).Ceil() * Utility.Tile - new Vector2(20, 14);
|
||||
plant.Resource = _resource;
|
||||
plant.Resource = (PlantResource)_resource;
|
||||
|
||||
PoolContainer.Instance.EntityField[_resource.Layer].Add(plant.GlobalPosition, plant);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue