Added WFC and respective parts (Tile, World, Layer, WFC, ResourceLoader)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Godot;
|
||||
using static GameData;
|
||||
|
||||
public partial class Camera3d : Camera3D
|
||||
{
|
||||
[Export] public float Speed = 7.5f;
|
||||
[Export] public float MouseSensitivity = 0.2f;
|
||||
[Export] public float ScrollStrength = 5.0f;
|
||||
|
||||
private Vector2 _mouseDelta;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
float d = (float)delta;
|
||||
|
||||
var rotation = RotationDegrees;
|
||||
rotation.X = Mathf.Clamp(rotation.X, -90f, 90f);
|
||||
RotationDegrees = rotation;
|
||||
|
||||
_mouseDelta = Vector2.Zero;
|
||||
|
||||
Vector3 direction = Vector3.Zero;
|
||||
if (Input.IsActionPressed("move_forward")&& Position.Z > 0) direction += Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_backward")&& Position.Z < layerSize * 4) direction -= Transform.Basis.Z;
|
||||
if (Input.IsActionPressed("move_left") && Position.X > 0) direction -= Transform.Basis.X;
|
||||
if (Input.IsActionPressed("move_right") && Position.X < layerSize * 4) direction += Transform.Basis.X;
|
||||
|
||||
if (direction != Vector3.Zero)
|
||||
{
|
||||
direction = direction.Normalized() * (Speed + 3 * Mathf.Log(Position.Y) + 1) * d;
|
||||
Translate(direction);
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("zoom_in") && Position.Y > 10)
|
||||
Translate(Transform.Basis.Y * ScrollStrength);
|
||||
|
||||
if (Input.IsActionJustPressed("zoom_out") && Position.Y < 50)
|
||||
Translate(-Transform.Basis.Y * ScrollStrength);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user