gd: weapon throws orients and throws itself correctly
This commit is contained in:
@ -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