Plant field hologram rework
This commit is contained in:
parent
ae4043d230
commit
435ca455f0
6 changed files with 23 additions and 21 deletions
|
|
@ -67,6 +67,7 @@ script = ExtResource("1_f4h5i")
|
|||
_maxHP = 100
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
use_parent_material = true
|
||||
texture = ExtResource("1_cmjrw")
|
||||
hframes = 2
|
||||
vframes = 10
|
||||
|
|
|
|||
|
|
@ -80,10 +80,12 @@ _data = {
|
|||
size = Vector2(26, 48)
|
||||
|
||||
[node name="Sunflower" type="Node2D"]
|
||||
use_parent_material = true
|
||||
script = ExtResource("1_2wmcw")
|
||||
_maxHP = 100
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
use_parent_material = true
|
||||
texture = ExtResource("2_fwcda")
|
||||
hframes = 2
|
||||
vframes = 9
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://dh6rm7o3taaek"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://dh6rm7o3taaek"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dstqh1wc5dvmo" path="res://assets/sprites/atlases/plants/wallnut.png" id="1_571nl"]
|
||||
[ext_resource type="Script" path="res://scripts/components/plants/RuntimePlantData.cs" id="1_mt5mt"]
|
||||
|
|
@ -81,20 +81,7 @@ _data = {
|
|||
"idle_mid": SubResource("Animation_c8ofx")
|
||||
}
|
||||
|
||||
[sub_resource type="VisualShader" id="VisualShader_w5h5j"]
|
||||
code = "shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
|
||||
|
||||
"
|
||||
graph_offset = Vector2(-551.922, -202.033)
|
||||
mode = 1
|
||||
flags/light_only = false
|
||||
nodes/fragment/0/position = Vector2(660, 100)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_a0k73"]
|
||||
shader = SubResource("VisualShader_w5h5j")
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ytjo1"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_523ui"]
|
||||
size = Vector2(33, 46)
|
||||
|
|
@ -105,12 +92,13 @@ _maxHP = 1000
|
|||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_7mgid")
|
||||
"": SubResource("AnimationLibrary_7mgid"),
|
||||
"wallnut": SubResource("AnimationLibrary_ytjo1")
|
||||
}
|
||||
autoplay = "idle_full"
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_a0k73")
|
||||
use_parent_material = true
|
||||
texture = ExtResource("1_571nl")
|
||||
hframes = 3
|
||||
vframes = 12
|
||||
|
|
|
|||
|
|
@ -11,5 +11,6 @@ shader_parameter/amount = 0.0
|
|||
material = SubResource("ShaderMaterial_0miwm")
|
||||
script = ExtResource("2_84bqh")
|
||||
|
||||
[node name="Preview" type="Sprite2D" parent="."]
|
||||
[node name="Preview" type="Node2D" parent="."]
|
||||
process_mode = 4
|
||||
use_parent_material = true
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
script = ExtResource("1_324sd")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
use_parent_material = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Newlon.Components.Level;
|
|||
|
||||
public partial class PlantField : Node2D
|
||||
{
|
||||
private Sprite2D _plantSetter;
|
||||
private Node2D _plantSetter;
|
||||
private PlantResource _resource;
|
||||
private Seedpacket _slot;
|
||||
private bool _previousCanPlace;
|
||||
|
|
@ -16,13 +16,23 @@ public partial class PlantField : Node2D
|
|||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
_plantSetter = GetChild<Sprite2D>(0);
|
||||
_plantSetter = GetChild<Node2D>(0);
|
||||
}
|
||||
|
||||
public void SetPlant(Seedpacket slot, PlantResource plant)
|
||||
{
|
||||
_resource = plant;
|
||||
_slot = slot;
|
||||
if (plant == null)
|
||||
{
|
||||
_plantSetter.GetChild(0).QueueFree();
|
||||
}
|
||||
else
|
||||
{
|
||||
var scene = plant.Scene.Instantiate<Node2D>();
|
||||
_plantSetter.AddChild(scene);
|
||||
scene.UseParentMaterial = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetPlant()
|
||||
|
|
@ -66,7 +76,6 @@ public partial class PlantField : Node2D
|
|||
|
||||
if (canPlace)
|
||||
_plantSetter.GlobalPosition = expected_pos;
|
||||
_plantSetter.Texture = _resource?.Preview;
|
||||
}
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue