Add Sara to floors

This commit is contained in:
2025-03-17 20:46:10 -07:00
parent 5e863dfd81
commit f50eaa1847
8 changed files with 424 additions and 1214 deletions

View File

@@ -1,13 +1,15 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using System.Collections.Generic;
using System;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
public partial class Sara : Enemy, IHasPrimaryAttack, ICanPatrol
public partial class Sara : Enemy, IHasPrimaryAttack, IHasSecondaryAttack, ICanPatrol
{
public override void _Notification(int what) => this.Notify(what);
@@ -18,6 +20,10 @@ public partial class Sara : Enemy, IHasPrimaryAttack, ICanPatrol
[Node] private INavigationAgentClient _navigationAgentClient { get; set; } = default!;
public ElementType SecondaryAttackElementalType { get; set; } = ElementType.None;
public double SecondaryAttackElementalDamageBonus { get; set; } = 1.0;
public void OnReady()
{
SetPhysicsProcess(true);
@@ -45,7 +51,10 @@ public partial class Sara : Enemy, IHasPrimaryAttack, ICanPatrol
public override void TakeAction()
{
PrimaryAttack();
var rng = new RandomNumberGenerator();
var options = new List<Action>() { PrimaryAttack, SecondaryAttack };
var selection = rng.RandWeighted([0.875f, 0.125f]);
options[(int)selection].Invoke();
}
public void PrimaryAttack()
@@ -53,6 +62,11 @@ public partial class Sara : Enemy, IHasPrimaryAttack, ICanPatrol
_enemyModelView.PlayPrimaryAttackAnimation();
}
public void SecondaryAttack()
{
_enemyModelView.PlaySecondaryAttackAnimation();
}
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
public void Patrol()

View File

@@ -436,6 +436,36 @@ tracks/2/keys = {
"values": [true]
}
[sub_resource type="Animation" id="Animation_r14ie"]
resource_name = "idle_back"
length = 2.08334
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_back"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333, 1.91667, 2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
}
[sub_resource type="Animation" id="Animation_sobol"]
resource_name = "idle_front"
length = 2.08334
@@ -496,36 +526,6 @@ tracks/1/keys = {
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
}
[sub_resource type="Animation" id="Animation_r14ie"]
resource_name = "idle_back"
length = 2.08334
loop_mode = 1
step = 0.0833333
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [&"idle_back"]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0833333, 0.166667, 0.25, 0.333333, 0.416667, 0.5, 0.583333, 0.666666, 0.75, 0.833333, 0.916666, 1, 1.08333, 1.16667, 1.25, 1.33333, 1.41667, 1.5, 1.58333, 1.66667, 1.75, 1.83333, 1.91667, 2),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
}
[sub_resource type="Animation" id="Animation_iw0no"]
resource_name = "primary_attack"
length = 0.500008
@@ -702,8 +702,8 @@ script = ExtResource("1_oh25a")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0, 0)
pixel_size = 0.003
billboard = 2
pixel_size = 0.005
billboard = 1
alpha_cut = 1
texture_filter = 0
render_priority = 100