Demon wall implementation time
This commit is contained in:
@@ -32,8 +32,10 @@ animation = &"ARM 1 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dqcrh"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bpd8u"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm1" type="Node3D"]
|
||||
script = ExtResource("2_w0a5p")
|
||||
_enemyStatResource = SubResource("Resource_yfb8x")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM1" parent="." instance=ExtResource("1_3tnuk")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 2 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_xj37f"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jlfdv"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm2" type="Node3D"]
|
||||
script = ExtResource("1_jkuo4")
|
||||
_enemyStatResource = SubResource("Resource_ni55f")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM2" parent="." instance=ExtResource("1_7rfsf")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 3 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p21h7"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1weac"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm3" type="Node3D"]
|
||||
script = ExtResource("1_fhrhk")
|
||||
_enemyStatResource = SubResource("Resource_gcbec")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM3" parent="." instance=ExtResource("1_wuuwb")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 4 SHOCK"
|
||||
animation = &"ARM 4 IDLE_001"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_s0ts5"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ggmev"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_nwywg"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_jlfdv")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm4" type="Node3D"]
|
||||
script = ExtResource("1_nwywg")
|
||||
_enemyStatResource = SubResource("Resource_0pjjv")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM4" parent="." instance=ExtResource("1_dr5tf")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 5 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_cpus0"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l47f2"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm5" type="Node3D"]
|
||||
script = ExtResource("1_j3ruw")
|
||||
_enemyStatResource = SubResource("Resource_bqpdp")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM5" parent="." instance=ExtResource("1_3y571")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 6 SLASH"
|
||||
animation = &"ARM 6 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bt0kd"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_stghn"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_xefo1"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_s0ts5")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm6" type="Node3D"]
|
||||
script = ExtResource("1_xefo1")
|
||||
_enemyStatResource = SubResource("Resource_7mykh")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM6" parent="." instance=ExtResource("1_txo11")]
|
||||
|
||||
|
||||
@@ -29,11 +29,13 @@ animation = &"7_ AGNI CONE"
|
||||
animation = &"ARM 7 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_728ue"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0admf"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mknr5"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["idle", "attack", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm7" type="Node3D"]
|
||||
script = ExtResource("1_enq7k")
|
||||
_enemyStatResource = SubResource("Resource_2r6oy")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM7" parent="." instance=ExtResource("1_kip2x")]
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ animation = &"ARM 8 MELEE"
|
||||
animation = &"ARM 8 IDLE"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0kspt"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -36,6 +37,7 @@ advance_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e3l4l"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_5tnjc"]
|
||||
states/attack/node = SubResource("AnimationNodeAnimation_cpus0")
|
||||
@@ -47,6 +49,8 @@ transitions = ["attack", "idle", SubResource("AnimationNodeStateMachineTransitio
|
||||
[node name="Arm8" type="Node3D"]
|
||||
script = ExtResource("1_5tnjc")
|
||||
_enemyStatResource = SubResource("Resource_p8nrl")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM8" parent="." instance=ExtResource("1_7eb4v")]
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ animation = &"ARM 9 IDLE"
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ryvbb"]
|
||||
xfade_time = 0.25
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_u8us3"]
|
||||
xfade_time = 0.25
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
@@ -47,6 +49,8 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
||||
[node name="Arm9" type="Node3D"]
|
||||
script = ExtResource("1_fjfqv")
|
||||
_enemyStatResource = SubResource("Resource_4tcsg")
|
||||
PrimaryAttackElementalType = null
|
||||
PrimaryAttackElementalDamageBonus = null
|
||||
|
||||
[node name="ARM9" parent="." instance=ExtResource("1_vc4af")]
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Zennysoft.Ma.Adapter;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DemonWall : Node3D
|
||||
public partial class DemonWall : CharacterBody3D
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -15,6 +15,8 @@ public partial class DemonWall : Node3D
|
||||
|
||||
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
|
||||
|
||||
[Node] private DemonWallArm _arm3 { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D LeftArms { get; set; } = default!;
|
||||
|
||||
[Node] public Node3D RightArms { get; set; } = default!;
|
||||
@@ -23,10 +25,11 @@ public partial class DemonWall : Node3D
|
||||
|
||||
[Node] private Node3D _rotation { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
}
|
||||
[Node] private AnimatableBody3D _opposingWall { get; set; } = default!;
|
||||
|
||||
[Export] private double _maximumWallMoveAmount = 24;
|
||||
|
||||
private Timer _attackTimer;
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
@@ -41,6 +44,37 @@ public partial class DemonWall : Node3D
|
||||
tweener.TweenMethod(Callable.From((float x) => RotateTowardsPlayer(x)), Eye.Rotation.Y, rotationAngle, 1f);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
_opposingWall.Show();
|
||||
var collisionShape = _opposingWall.GetChildren().OfType<CollisionShape3D>().Single();
|
||||
collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false);
|
||||
|
||||
_attackTimer = new Timer { WaitTime = 5f };
|
||||
_attackTimer.Timeout += AttackTimer_Timeout;
|
||||
AddChild(_attackTimer);
|
||||
SetPhysicsProcess(true);
|
||||
_attackTimer.Start();
|
||||
}
|
||||
|
||||
private void AttackTimer_Timeout()
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
|
||||
var leftArms = new Godot.Collections.Array<DemonWallArm>(LeftArms.GetChildren().Cast<DemonWallArm>());
|
||||
var rightArms = new Godot.Collections.Array<DemonWallArm>(RightArms.GetChildren().Cast<DemonWallArm>());
|
||||
|
||||
var leftArm = leftArms.PickRandom();
|
||||
var rightArm = rightArms.PickRandom();
|
||||
|
||||
leftArm.PrimaryAttack();
|
||||
rightArm.PrimaryAttack();
|
||||
|
||||
if (leftArm == _arm3 && _opposingWall.Position.Z > -_maximumWallMoveAmount)
|
||||
MoveWall();
|
||||
}
|
||||
|
||||
private float GetRotationAngle()
|
||||
{
|
||||
var target = new Vector3(_player.CurrentPosition.X, Position.Y, _player.CurrentPosition.Z);
|
||||
@@ -49,5 +83,21 @@ public partial class DemonWall : Node3D
|
||||
return _rotation.Rotation.Y;
|
||||
}
|
||||
|
||||
private void MoveWall()
|
||||
{
|
||||
var tweener = GetTree().CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => MoveWallTowardsPlayer(x)), _opposingWall.Position.Z, _opposingWall.Position.Z - 2, 3f);
|
||||
}
|
||||
|
||||
private void RotateTowardsPlayer(float angle) => Eye.Rotation = new Vector3(Eye.Rotation.X, angle, Eye.Rotation.Z);
|
||||
|
||||
private void MoveWallTowardsPlayer(float moveAmount)
|
||||
{
|
||||
_opposingWall.Position = new Vector3(_opposingWall.Position.X, _opposingWall.Position.Y, moveAmount);
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
_attackTimer.Timeout -= AttackTimer_Timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=27 format=4 uid="uid://6kck5vborfyk"]
|
||||
[gd_scene load_steps=29 format=4 uid="uid://6kck5vborfyk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dlvk70cr20nva" path="res://src/enemy/enemy_types/16. demon wall/DemonWall.cs" id="1_dqcrh"]
|
||||
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_bpd8u"]
|
||||
@@ -163,7 +163,13 @@ _surfaces = [{
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource("ArrayMesh_yunh4")
|
||||
|
||||
[node name="Demon Wall" type="Node3D"]
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_5ht6q"]
|
||||
size = Vector3(28.312, 10.3551, 2.86102)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_l48m2"]
|
||||
size = Vector3(28.2825, 12.6552, 4.15076)
|
||||
|
||||
[node name="Demon Wall" type="CharacterBody3D"]
|
||||
script = ExtResource("1_dqcrh")
|
||||
_enemyStatResource = SubResource("Resource_ccv8a")
|
||||
|
||||
@@ -179,6 +185,7 @@ unique_name_in_owner = true
|
||||
[node name="Arm2" parent="LeftArms" instance=ExtResource("4_qignv")]
|
||||
|
||||
[node name="Arm3" parent="LeftArms" instance=ExtResource("5_kosjo")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Arm4" parent="LeftArms" instance=ExtResource("6_dqcrh")]
|
||||
|
||||
@@ -215,5 +222,20 @@ transform = Transform3D(1.53728, 0.0209947, 0.0380914, 0.00298547, 1.29824, -0.8
|
||||
mesh = SubResource("ArrayMesh_l6g6j")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="demon_wall_summoned_wall" parent="." instance=ExtResource("16_5ht6q")]
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.40518, 8.3319, 1.76666)
|
||||
shape = SubResource("BoxShape3D_5ht6q")
|
||||
|
||||
[node name="OpposingWall" type="AnimatableBody3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="Summoned Wall Model" parent="OpposingWall" instance=ExtResource("16_5ht6q")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 4.3, 42)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="OpposingWall"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.296021, 10.2941, 42.0277)
|
||||
shape = SubResource("BoxShape3D_l48m2")
|
||||
disabled = true
|
||||
|
||||
@@ -6,17 +6,23 @@ using Zennysoft.Ma.Adapter;
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class DemonWallArm : Node3D, IHasPrimaryAttack
|
||||
public partial class DemonWallArm : Node3D
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Signal]
|
||||
public delegate void MoveWallEventHandler();
|
||||
|
||||
private const string PARAMETERS_PLAYBACK = "parameters/playback";
|
||||
private const string ATTACK = "attack";
|
||||
|
||||
[Node] public AnimationTree AnimationTree { get; set; } = default!;
|
||||
|
||||
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
|
||||
|
||||
public ElementType PrimaryAttackElementalType { set => throw new System.NotImplementedException(); }
|
||||
[Export] public ElementType PrimaryAttackElementalType { get; set; } = ElementType.None;
|
||||
|
||||
public double PrimaryAttackElementalDamageBonus { set => throw new System.NotImplementedException(); }
|
||||
[Export] public double PrimaryAttackElementalDamageBonus { get; set; } = 1.0f;
|
||||
|
||||
public void PrimaryAttack() => throw new System.NotImplementedException();
|
||||
public void PrimaryAttack() => AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ATTACK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user