Improvements to save and loading
Improvements to Chinthe animation logic Fix broken Godot Tool system and just use a more manual approach to setting map nodes Remove ItemDatabase from individual room scenes
This commit is contained in:
@@ -45,6 +45,8 @@ public abstract partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLo
|
||||
|
||||
[Export] public int ExpGiven { get; set; } = 10;
|
||||
|
||||
private bool _activated = false;
|
||||
|
||||
public Enemy()
|
||||
{
|
||||
HealthComponent = new HealthComponent(InitialHP);
|
||||
@@ -72,7 +74,9 @@ public abstract partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLo
|
||||
EnemyBinding
|
||||
.Handle((in EnemyLogic.Output.Activate _) =>
|
||||
{
|
||||
Activate();
|
||||
if (!_activated)
|
||||
Activate();
|
||||
_activated = true;
|
||||
})
|
||||
.Handle((in EnemyLogic.Output.Idle _) =>
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ public abstract partial class Enemy2D : Enemy
|
||||
{
|
||||
var collider = Raycast.GetCollider();
|
||||
if (collider is IPlayer)
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Attack());
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Alert());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -16,6 +15,10 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
private readonly string _primaryAttackName = "Primary Attack";
|
||||
private readonly string _secondaryAttackName = "Secondary Attack";
|
||||
private readonly string _activateName = "Activate";
|
||||
private readonly string _activateFront = "activate";
|
||||
private readonly string _activateLeft = "activate_left";
|
||||
private readonly string _activateRight = "activate_right";
|
||||
private readonly string _activateBack = "activate_back";
|
||||
private readonly string _parametersPlayback = "parameters/playback";
|
||||
|
||||
[Node] public AnimationTree AnimationTree { get; set; } = default!;
|
||||
@@ -26,9 +29,15 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
|
||||
public event EventHandler HitPlayer;
|
||||
|
||||
public event EventHandler ActivationFinished;
|
||||
|
||||
[Export]
|
||||
public bool CanMove { get; set; } = false;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
}
|
||||
|
||||
public virtual void PlayPrimaryAttackAnimation() => _stateMachine.Travel(_primaryAttackName);
|
||||
@@ -49,6 +58,13 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
|
||||
|
||||
protected virtual void OnPlayerHit(AttackEventArgs arg) => HitPlayer?.Invoke(this, arg);
|
||||
|
||||
private void AnimationTree_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == _activateFront || animName == _activateLeft || animName == _activateRight || animName == _activateBack)
|
||||
ActivationFinished?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface IEnemyModelView : INode3D
|
||||
public void PlayDeathAnimation();
|
||||
|
||||
public event EventHandler HitPlayer;
|
||||
|
||||
public event EventHandler ActivationFinished;
|
||||
}
|
||||
|
||||
@@ -87,4 +87,4 @@ states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft")]
|
||||
graph_offset = Vector2(0, 26.7654)
|
||||
graph_offset = Vector2(-372.546, -3.34571)
|
||||
|
||||
@@ -15,18 +15,34 @@ public partial class Chinthe : Enemy2D, IHaveEngagePlayerBehavior, IHaveFollowBe
|
||||
[Node] public Area3D PlayerDetector { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
EnemyModelView.ActivationFinished += EnemyModelView_ActivationFinished;
|
||||
SetPhysicsProcess(true);
|
||||
}
|
||||
|
||||
private void EnemyModelView_ActivationFinished(object sender, System.EventArgs e)
|
||||
{
|
||||
FollowBehavior.Init(NavigationAgent);
|
||||
FollowBehavior.OnVelocityComputed += OnVelocityComputed;
|
||||
FollowBehavior.OnVelocityComputed += OnChintheVelocityComputed;
|
||||
EngagePlayerBehavior.TakeAction += EngagePlayerBehavior_TakeAction;
|
||||
EngagePlayerBehavior.AcquireTarget += EngagePlayerBehavior_AcquireTarget;
|
||||
PlayerDetector.BodyEntered += PlayerDetector_BodyEntered;
|
||||
PlayerDetector.BodyExited += PlayerDetector_BodyExited;
|
||||
SetPhysicsProcess(true);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Follow());
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Move());
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
{
|
||||
EnemyModelView.PlayActivateAnimation();
|
||||
}
|
||||
|
||||
public void OnChintheVelocityComputed(Vector3 safeVelocity)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Move());
|
||||
Velocity = safeVelocity;
|
||||
LookAtTarget(safeVelocity);
|
||||
if (((EnemyModelView)EnemyModelView).CanMove)
|
||||
MoveAndSlide();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://fwtjthix6awv" path="res://src/enemy/enemy_types/07. chinthe/Chinthe.cs" id="1_120m2"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="3_567xa"]
|
||||
[ext_resource type="PackedScene" uid="uid://byd7cwxq1be6f" path="res://src/enemy/enemy_types/07. chinthe/ChinteModelView.tscn" id="3_ncr2e"]
|
||||
[ext_resource type="PackedScene" uid="uid://byd7cwxq1be6f" path="res://src/enemy/enemy_types/07. chinthe/ChintheModelView.tscn" id="3_ncr2e"]
|
||||
[ext_resource type="PackedScene" uid="uid://mqj4jju3870v" path="res://src/enemy/behaviors/FollowBehavior.tscn" id="6_t7elt"]
|
||||
[ext_resource type="PackedScene" uid="uid://8bcme8ao4axa" path="res://src/enemy/behaviors/EngagePlayerBehavior.tscn" id="7_24q6i"]
|
||||
|
||||
@@ -24,6 +24,7 @@ metadata/_custom_type_script = "uid://dlsgyx4i1jmp3"
|
||||
radius = 1.20703
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_q6h01"]
|
||||
radius = 1.26172
|
||||
|
||||
[node name="Chinthe" type="CharacterBody3D"]
|
||||
process_mode = 1
|
||||
@@ -81,7 +82,7 @@ shape = SubResource("CylinderShape3D_q6h01")
|
||||
|
||||
[node name="FollowBehavior" parent="Components" instance=ExtResource("6_t7elt")]
|
||||
unique_name_in_owner = true
|
||||
_followSpeed = 150.0
|
||||
_followSpeed = 500.0
|
||||
|
||||
[node name="EngagePlayerBehavior" parent="Components" instance=ExtResource("7_24q6i")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=469 format=3 uid="uid://byd7cwxq1be6f"]
|
||||
[gd_scene load_steps=475 format=3 uid="uid://byd7cwxq1be6f"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_6dej3"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnd6d5cx7x7i8" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/BACK/0400.png" id="2_3sdh3"]
|
||||
@@ -393,6 +393,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://b6yiy63mab0q0" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/FRONT/0350.png" id="388_l12jf"]
|
||||
[ext_resource type="Texture2D" uid="uid://gteini5vxmj1" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/FRONT/0352.png" id="389_whqu2"]
|
||||
[ext_resource type="Texture2D" uid="uid://csdrkeer8xklt" path="res://src/enemy/enemy_types/07. chinthe/animations/CHINTHE - RERENDER/FRONT/0354.png" id="390_ksvn0"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="394_ldtka"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="395_jbhro"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7pf2dib2ilhs" path="res://src/vfx/Enemy/CHINTHE_BLAST.png" id="395_ymova"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]
|
||||
@@ -1725,7 +1727,7 @@ tracks/4/keys = {
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath(".:CanMove")
|
||||
tracks/5/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:flip_h")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
@@ -1737,86 +1739,86 @@ tracks/5/keys = {
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
tracks/6/enabled = true
|
||||
tracks/6/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:flip_h")
|
||||
tracks/6/path = NodePath("Sprite3D:scale:x")
|
||||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
"update": 0,
|
||||
"values": [1.5]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("Sprite3D:scale:x")
|
||||
tracks/7/path = NodePath("Sprite3D:scale")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1.5]
|
||||
"values": [Vector3(1.5, 1.5, 1.5)]
|
||||
}
|
||||
tracks/8/type = "value"
|
||||
tracks/8/imported = false
|
||||
tracks/8/enabled = true
|
||||
tracks/8/path = NodePath("Sprite3D:scale")
|
||||
tracks/8/path = NodePath("Sprite3D:modulate")
|
||||
tracks/8/interp = 1
|
||||
tracks/8/loop_wrap = true
|
||||
tracks/8/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector3(1.5, 1.5, 1.5)]
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/9/type = "value"
|
||||
tracks/9/imported = false
|
||||
tracks/9/enabled = true
|
||||
tracks/9/path = NodePath("Sprite3D:modulate")
|
||||
tracks/9/path = NodePath("GPUParticles3D:emitting")
|
||||
tracks/9/interp = 1
|
||||
tracks/9/loop_wrap = true
|
||||
tracks/9/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/10/type = "value"
|
||||
tracks/10/imported = false
|
||||
tracks/10/enabled = true
|
||||
tracks/10/path = NodePath("GPUParticles3D:emitting")
|
||||
tracks/10/path = NodePath("Sprite3D:transparency")
|
||||
tracks/10/interp = 1
|
||||
tracks/10/loop_wrap = true
|
||||
tracks/10/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/11/type = "value"
|
||||
tracks/11/imported = false
|
||||
tracks/11/enabled = true
|
||||
tracks/11/path = NodePath("Sprite3D:transparency")
|
||||
tracks/11/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:modulate")
|
||||
tracks/11/interp = 1
|
||||
tracks/11/loop_wrap = true
|
||||
tracks/11/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/12/type = "value"
|
||||
tracks/12/imported = false
|
||||
tracks/12/enabled = true
|
||||
tracks/12/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:modulate")
|
||||
tracks/12/path = NodePath(".:CanMove")
|
||||
tracks/12/interp = 1
|
||||
tracks/12/loop_wrap = true
|
||||
tracks/12/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7d8af"]
|
||||
@@ -1949,7 +1951,7 @@ tracks/2/keys = {
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xydva"]
|
||||
resource_name = "idle_back"
|
||||
length = 3.33334
|
||||
length = 6.66667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -1971,15 +1973,15 @@ tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSpri
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3.33333),
|
||||
"times": PackedFloat32Array(0, 6.66666),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 40]
|
||||
"values": [0, 80]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fn0g1"]
|
||||
resource_name = "idle_front"
|
||||
length = 3.33334
|
||||
length = 6.66667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -2001,15 +2003,15 @@ tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSpri
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3.33133),
|
||||
"times": PackedFloat32Array(0, 6.66667),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 40]
|
||||
"values": [0, 80]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_iapwd"]
|
||||
resource_name = "idle_left"
|
||||
length = 3.33334
|
||||
length = 6.66667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -2031,15 +2033,15 @@ tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSpri
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3.33133),
|
||||
"times": PackedFloat32Array(0, 6.66666),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 40]
|
||||
"values": [0, 80]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_nvqie"]
|
||||
resource_name = "idle_right"
|
||||
length = 3.33334
|
||||
length = 6.66667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -2061,10 +2063,10 @@ tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSpri
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3.33133),
|
||||
"times": PackedFloat32Array(0, 6.66666),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 40]
|
||||
"values": [0, 80]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
@@ -2238,7 +2240,7 @@ tracks/3/path = NodePath(".:CanMove")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.166533, 0.417721),
|
||||
"times": PackedFloat32Array(0, 0.0833333, 0.416667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [false, true, false]
|
||||
@@ -2924,32 +2926,45 @@ advance_mode = 2
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_2oumr"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gr3tp"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_oxq0i"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ixs6i"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jbhro"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_keq07"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_w4c47"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5lbxl"]
|
||||
xfade_time = 0.2
|
||||
break_loop_at_end = true
|
||||
switch_mode = 1
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_li182"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sgkk0"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_nvqie"]
|
||||
states/Activate/node = ExtResource("243_5jjkq")
|
||||
states/Activate/position = Vector2(583, 100)
|
||||
"states/Activated Idle/node" = ExtResource("244_2oumr")
|
||||
"states/Activated Idle/position" = Vector2(348, 285)
|
||||
states/Idle/node = ExtResource("245_gr3tp")
|
||||
states/Idle/position = Vector2(357, 100)
|
||||
"states/Primary Attack/node" = ExtResource("244_2oumr")
|
||||
"states/Primary Attack/position" = Vector2(583, 285)
|
||||
states/Idle/node = ExtResource("244_2oumr")
|
||||
states/Idle/position = Vector2(348, 285)
|
||||
"states/Primary Attack/node" = ExtResource("394_ldtka")
|
||||
"states/Primary Attack/position" = Vector2(623.437, 285)
|
||||
"states/Secondary Attack/node" = SubResource("AnimationNodeAnimation_op3hf")
|
||||
"states/Secondary Attack/position" = Vector2(583, 404)
|
||||
states/Start/position = Vector2(199, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_umemc"), "Idle", "Activate", SubResource("AnimationNodeStateMachineTransition_t3xhd"), "Activate", "Activated Idle", SubResource("AnimationNodeStateMachineTransition_5jjkq"), "Activated Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_2oumr"), "Activated Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_gr3tp"), "Primary Attack", "Activated Idle", SubResource("AnimationNodeStateMachineTransition_oxq0i"), "Secondary Attack", "Activated Idle", SubResource("AnimationNodeStateMachineTransition_ixs6i")]
|
||||
graph_offset = Vector2(-27, 57)
|
||||
"states/Unactivated Idle/node" = ExtResource("245_gr3tp")
|
||||
"states/Unactivated Idle/position" = Vector2(357, 100)
|
||||
states/Walking/node = ExtResource("395_jbhro")
|
||||
states/Walking/position = Vector2(348, 398.498)
|
||||
transitions = ["Start", "Unactivated Idle", SubResource("AnimationNodeStateMachineTransition_umemc"), "Unactivated Idle", "Activate", SubResource("AnimationNodeStateMachineTransition_t3xhd"), "Activate", "Idle", SubResource("AnimationNodeStateMachineTransition_5jjkq"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_gr3tp"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_ixs6i"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_jbhro"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_keq07"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_w4c47"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_5lbxl"), "Walking", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_li182"), "Walking", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_sgkk0")]
|
||||
graph_offset = Vector2(-196.563, 205.778)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tawq7"]
|
||||
atlas = ExtResource("395_ymova")
|
||||
@@ -3183,7 +3198,7 @@ tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [14]
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wj5ph"]
|
||||
@@ -3268,7 +3283,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.788494, 0.186749, 0.63838)
|
||||
billboard = 2
|
||||
render_priority = 101
|
||||
sprite_frames = SubResource("SpriteFrames_4f8vl")
|
||||
frame = 14
|
||||
|
||||
[node name="Attack VFX" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
@@ -9,5 +9,5 @@ public interface IEnemyLogic : ILogicBlock<EnemyLogic.State>;
|
||||
[LogicBlock(typeof(State), Diagram = false)]
|
||||
public partial class EnemyLogic : LogicBlock<EnemyLogic.State>, IEnemyLogic
|
||||
{
|
||||
public override Transition GetInitialState() => To<State.Idle>();
|
||||
public override Transition GetInitialState() => To<State.Unactivated>();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Chickensoft.Introspection;
|
||||
using static Zennysoft.Game.Ma.EnemyLogic.Input;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -7,9 +8,19 @@ public partial class EnemyLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_activated")]
|
||||
public partial record Activated : Alive
|
||||
public partial record Activated : Alive,
|
||||
IGet<ReachedPlayer>,
|
||||
IGet<Patrol>,
|
||||
IGet<Follow>,
|
||||
IGet<Reset>
|
||||
{
|
||||
public Activated() => OnAttach(() => Output(new Output.Activate()));
|
||||
}
|
||||
|
||||
public Transition On(in ReachedPlayer input) => To<EngagePlayer>();
|
||||
|
||||
public Transition On(in Patrol _) => To<Patrolling>();
|
||||
|
||||
public Transition On(in Follow _) => To<FollowPlayer>();
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,8 @@ public partial class EnemyLogic
|
||||
public abstract partial record Alive : State,
|
||||
IGet<Input.Idle>,
|
||||
IGet<Move>,
|
||||
IGet<ReachedPlayer>,
|
||||
IGet<Patrol>,
|
||||
IGet<Follow>,
|
||||
IGet<Reset>,
|
||||
IGet<Input.Defeated>
|
||||
{
|
||||
public Transition On(in ReachedPlayer input) => To<EngagePlayer>();
|
||||
|
||||
public Transition On(in Patrol _) => To<Patrolling>();
|
||||
|
||||
public Transition On(in Follow _) => To<FollowPlayer>();
|
||||
|
||||
public Transition On(in Reset input)
|
||||
{
|
||||
Output(new Output.ReturnToDefaultState());
|
||||
|
||||
@@ -8,7 +8,7 @@ public partial class EnemyLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_engage_player")]
|
||||
public partial record EngagePlayer : Alive
|
||||
public partial record EngagePlayer : Activated
|
||||
{
|
||||
public EngagePlayer()
|
||||
{
|
||||
@@ -17,6 +17,7 @@ public partial class EnemyLogic
|
||||
var enemy = Get<IEnemy>();
|
||||
if (enemy is IHaveEngagePlayerBehavior engagePlayerEnemy)
|
||||
engagePlayerEnemy.EngagePlayerBehavior.Engage();
|
||||
enemy.Idle();
|
||||
});
|
||||
OnDetach(() =>
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ public partial class EnemyLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_followplayer")]
|
||||
public partial record FollowPlayer : Alive, IGet<Input.LoseTrackOfTarget>
|
||||
public partial record FollowPlayer : Activated, IGet<Input.LoseTrackOfTarget>
|
||||
{
|
||||
public FollowPlayer()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ public partial class EnemyLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_idle")]
|
||||
public partial record Idle : Alive
|
||||
public partial record Idle : Activated
|
||||
{
|
||||
public Idle() => OnAttach(() => Output(new Output.Idle()));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public partial class EnemyLogic
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_patrolling")]
|
||||
public partial record Patrolling : Alive
|
||||
public partial record Patrolling : Activated
|
||||
{
|
||||
public Patrolling()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using Chickensoft.Introspection;
|
||||
using static Zennysoft.Game.Ma.EnemyLogic.Input;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class EnemyLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("enemy_logic_state_unactivated")]
|
||||
public partial record Unactivated : Alive, IGet<Alert>
|
||||
{
|
||||
public Transition On(in Alert _) => To<Activated>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user