folder refactoring, plant_base adjustments
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Camera;
|
||||
|
||||
public partial class CameraController : Camera2D
|
||||
{
|
||||
[Export] private float _multiplier = 1.0f;
|
||||
[Export] private Node2D _followNode;
|
||||
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
this.Position = _followNode.Transform.Origin * _multiplier;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqomwxclsbhd3
|
||||
@@ -0,0 +1,45 @@
|
||||
using Godot;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Camera;
|
||||
|
||||
public partial class CameraPivot : Node3D
|
||||
{
|
||||
[Export] private bool _canPitch;
|
||||
[Export] private bool _canYaw;
|
||||
[Export] private float _rotateSpeed = 0.003f;
|
||||
[Export] private Node3D _subPivot;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Captured;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if(@event.IsActionPressed("click"))
|
||||
{
|
||||
if (Input.MouseMode == Input.MouseModeEnum.Visible)
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Captured;
|
||||
}
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed("ui_cancel"))
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
}
|
||||
|
||||
if (@event is InputEventMouseMotion test)
|
||||
{
|
||||
if (Input.MouseMode != Input.MouseModeEnum.Captured)
|
||||
return;
|
||||
|
||||
if (_canYaw)
|
||||
_subPivot.RotateX(test.Relative.Y * -_rotateSpeed);
|
||||
if(_canPitch)
|
||||
this.RotateY(test.Relative.X * -_rotateSpeed);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://r5tahuqvbucy
|
||||
Reference in New Issue
Block a user