gd: weapon throws orients and throws itself correctly
This commit is contained in:
@ -125,6 +125,7 @@ offset_left = 840.0
|
||||
offset_top = 1.0
|
||||
offset_right = -2.0
|
||||
offset_bottom = 1.0
|
||||
enabled = false
|
||||
initial_node_to_watch = NodePath("../StateChart")
|
||||
|
||||
[node name="StateChart" type="Node" parent="."]
|
||||
@ -186,7 +187,8 @@ delay_in_seconds = "0.0"
|
||||
[node name="WeaponRoot" type="Node3D" parent="."]
|
||||
|
||||
[node name="WeaponSystem" parent="WeaponRoot" instance=ExtResource("29_wv70j")]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.984902, 0.173115, 0, -0.173115, 0.984902, 0.45268, 1.44035, -0.692528)
|
||||
transform = Transform3D(1, 0, 0, 0, 0.173648, -0.984808, 0, 0.984808, 0.173648, 0.45268, 1.44035, -0.692528)
|
||||
ThrowForce = 25.0
|
||||
|
||||
[connection signal="input_aim_canceled" from="InputController" to="." method="OnInputAimCanceled"]
|
||||
[connection signal="input_aim_pressed" from="InputController" to="." method="OnInputAimPressed"]
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Godot;
|
||||
using GodotStateCharts;
|
||||
using Movementtests.systems;
|
||||
@ -152,11 +153,28 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public void OnWeaponThrown()
|
||||
{
|
||||
RemoveChild(WeaponRoot);
|
||||
GetTree().GetRoot().AddChild(WeaponRoot);
|
||||
WeaponRoot.SetGlobalPosition(GlobalPosition);
|
||||
|
||||
var (hasHit, location, collisionPoint, collisionNormal) = DashSystem.DashComputation;
|
||||
var (endWithMantle, dashLocation, mantleLocation) = DashSystem.DashResolve;
|
||||
WeaponSystem.ThrowWeapon(Position, dashLocation, hasHit, collisionPoint, collisionNormal);
|
||||
|
||||
DashSystem.CancelDash();
|
||||
// RemoveChild(WeaponSystem);
|
||||
WeaponSystem.ThrowWeapon(location, hasHit, collisionPoint, collisionNormal);
|
||||
}
|
||||
|
||||
public void OnDashEnded()
|
||||
{
|
||||
// Generates an error when dashing normally
|
||||
// This should solve itself when we handle weapon thrown dashes and regular dashes through different states
|
||||
GetTree().GetRoot().RemoveChild(WeaponRoot);
|
||||
AddChild(WeaponRoot);
|
||||
|
||||
WeaponRoot.SetGlobalPosition(GlobalPosition);
|
||||
WeaponSystem.ResetWeapon();
|
||||
|
||||
_playerState.SendEvent("dash_ended");
|
||||
}
|
||||
|
||||
public void OnInputMove(Vector3 value)
|
||||
@ -192,13 +210,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
_playerState.SendEvent("hit_pressed");
|
||||
}
|
||||
|
||||
public void OnDashEnded()
|
||||
{
|
||||
_playerState.SendEvent("dash_ended");
|
||||
// AddChild(WeaponSystem);
|
||||
WeaponSystem.ResetWeapon();
|
||||
}
|
||||
|
||||
public void OnInputJumpPressed()
|
||||
{
|
||||
@ -211,13 +222,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
WeaponRoot.SetRotation(HeadSystem.Rotation);
|
||||
|
||||
var isPlayerDead = HealthSystem.IsDead();
|
||||
var isHeadTouchingCeiling = IsHeadTouchingCeiling();
|
||||
|
||||
TweenQueueSystem.ProcessTweens();
|
||||
|
||||
if (_weaponInHand.Active || _aiming.Active)
|
||||
WeaponRoot.SetRotation(HeadSystem.Rotation);
|
||||
if (_aiming.Active)
|
||||
DashSystem.PrepareDash();
|
||||
|
||||
|
Reference in New Issue
Block a user