display resource renamed to entity resource
This commit is contained in:
parent
d5573db251
commit
cea648f0ff
8 changed files with 13 additions and 13 deletions
|
|
@ -26,7 +26,7 @@ public partial class Previewport : SubViewport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeDisplay(DisplayResource resource)
|
private void ChangeDisplay(EntityResource resource)
|
||||||
{
|
{
|
||||||
// Expand with updates
|
// Expand with updates
|
||||||
if (current_display != null)
|
if (current_display != null)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ public partial class Seedpacket : TextureButton
|
||||||
public static AudioStream UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
|
public static AudioStream UntapStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/tap2.mp3");
|
||||||
public static AudioStream LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
|
public static AudioStream LiftStream = ResourceLoader.Load<AudioStream>("res://assets/audio/gui/seedlift.mp3");
|
||||||
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
|
private const string PATH_TO_PACKED_SCENE = "res://scenes/gui/seedpacket.tscn";
|
||||||
private DisplayResource _resource;
|
private EntityResource _resource;
|
||||||
private Label _cost;
|
private Label _cost;
|
||||||
private TextureRect _icon;
|
private TextureRect _icon;
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
|
|
@ -46,14 +46,14 @@ public partial class Seedpacket : TextureButton
|
||||||
}
|
}
|
||||||
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
|
if (_handler is ISeedpacketProcess processHandler) processHandler.Process();
|
||||||
}
|
}
|
||||||
public void SetResource(DisplayResource resource)
|
public void SetResource(EntityResource resource)
|
||||||
{
|
{
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
|
|
||||||
UpdateContents();
|
UpdateContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayResource GetResource()
|
public EntityResource GetResource()
|
||||||
{
|
{
|
||||||
return _resource;
|
return _resource;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ namespace Newlon.Components.Level;
|
||||||
public partial class PlantField : Node2D
|
public partial class PlantField : Node2D
|
||||||
{
|
{
|
||||||
private Node2D _plantSetter;
|
private Node2D _plantSetter;
|
||||||
private DisplayResource _resource;
|
private EntityResource _resource;
|
||||||
private Seedpacket _slot;
|
private Seedpacket _slot;
|
||||||
private bool _previousCanPlace;
|
private bool _previousCanPlace;
|
||||||
private ChannelPlayer player;
|
private ChannelPlayer player;
|
||||||
|
|
@ -21,7 +21,7 @@ public partial class PlantField : Node2D
|
||||||
player = GetNode<ChannelPlayer>("PlantPlayer");
|
player = GetNode<ChannelPlayer>("PlantPlayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPlant(Seedpacket slot, DisplayResource resource)
|
public void SetPlant(Seedpacket slot, EntityResource resource)
|
||||||
{
|
{
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
_slot = slot;
|
_slot = slot;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
[Tool]
|
[Tool]
|
||||||
public partial class DisplayResource : Resource
|
public partial class EntityResource : Resource
|
||||||
{
|
{
|
||||||
[Export] public string name_key;
|
[Export] public string name_key;
|
||||||
[Export] public string description_key;
|
[Export] public string description_key;
|
||||||
|
|
@ -4,6 +4,6 @@ namespace Newlon;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
[Tool]
|
[Tool]
|
||||||
public partial class PlantResource : DisplayResource
|
public partial class PlantResource : EntityResource
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ using Godot;
|
||||||
|
|
||||||
[GlobalClass]
|
[GlobalClass]
|
||||||
[Tool]
|
[Tool]
|
||||||
public partial class ZombieResource : DisplayResource
|
public partial class ZombieResource : EntityResource
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ public partial class GameRegistry : Node
|
||||||
private const string PLANT_RESOURCE_PATH = "res://assets/plants/";
|
private const string PLANT_RESOURCE_PATH = "res://assets/plants/";
|
||||||
private const string ZOMBIE_RESOURCE_PATH = "res://assets/zombies/";
|
private const string ZOMBIE_RESOURCE_PATH = "res://assets/zombies/";
|
||||||
public static GameRegistry Instance { get; private set; }
|
public static GameRegistry Instance { get; private set; }
|
||||||
public static readonly Dictionary<string, DisplayResource> EntityDictionary = [];
|
public static readonly Dictionary<string, EntityResource> EntityDictionary = [];
|
||||||
|
|
||||||
public override void _EnterTree()
|
public override void _EnterTree()
|
||||||
{
|
{
|
||||||
|
|
@ -37,7 +37,7 @@ public partial class GameRegistry : Node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DisplayResource GetEntityByName(string name)
|
public static EntityResource GetEntityByName(string name)
|
||||||
{
|
{
|
||||||
if (EntityDictionary.ContainsKey(name) == false) return null;
|
if (EntityDictionary.ContainsKey(name) == false) return null;
|
||||||
return EntityDictionary[name];
|
return EntityDictionary[name];
|
||||||
|
|
@ -51,9 +51,9 @@ public partial class GameRegistry : Node
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static List<DisplayResource> GetEntities()
|
public static List<EntityResource> GetEntities()
|
||||||
{
|
{
|
||||||
List<DisplayResource> result = [];
|
List<EntityResource> result = [];
|
||||||
foreach (var value in EntityDictionary.Values)
|
foreach (var value in EntityDictionary.Values)
|
||||||
{
|
{
|
||||||
result.Add(value);
|
result.Add(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue