Re-scaled environment models imported and implemented.
This commit is contained in:
@@ -54,10 +54,10 @@ public partial class DataViewer : Control, IDataViewer
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
BackButton.Pressed += BackButton_Pressed;
|
||||
_enemies = [.. ModelPivot.GetChildren().Cast<EnemyModelView>()];
|
||||
_currentModel = _enemies.First();
|
||||
DisplayEnemy();
|
||||
BackButton.Pressed += BackButton_Pressed;
|
||||
_enemies = [.. ModelPivot.GetChildren().Cast<EnemyModelView>()];
|
||||
_currentModel = _enemies.First();
|
||||
DisplayEnemy();
|
||||
}
|
||||
|
||||
public void OnEnterTree() => GetTree().Paused = false;
|
||||
@@ -68,97 +68,97 @@ public partial class DataViewer : Control, IDataViewer
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (BackButton.HasFocus() && @event.IsActionPressed(GameInputs.Interact))
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
BackButton.ReleaseFocus();
|
||||
return;
|
||||
}
|
||||
if (BackButton.HasFocus() && @event.IsActionPressed(GameInputs.Interact))
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
BackButton.ReleaseFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentModel == null || BackButton.HasFocus())
|
||||
return;
|
||||
if (_currentModel == null || BackButton.HasFocus())
|
||||
return;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
_currentModel.PlayPrimaryAttackAnimation();
|
||||
if (@event.IsActionPressed(GameInputs.InventorySort))
|
||||
_currentModel.PlaySecondaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory))
|
||||
_currentModel.PlayActivateAnimation();
|
||||
if (@event.IsActionPressed(GameInputs.EnemyViewerWalk))
|
||||
_currentModel.PlayWalkAnimation();
|
||||
if (@event.IsActionReleased(GameInputs.EnemyViewerWalk))
|
||||
_currentModel.PlayIdleAnimation();
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
_currentModel.PlayPrimaryAttackAnimation();
|
||||
if (@event.IsActionPressed(GameInputs.InventorySort))
|
||||
_currentModel.PlaySecondaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory))
|
||||
_currentModel.PlayActivateAnimation();
|
||||
if (@event.IsActionPressed(GameInputs.EnemyViewerWalk))
|
||||
_currentModel.PlayWalkAnimation();
|
||||
if (@event.IsActionReleased(GameInputs.EnemyViewerWalk))
|
||||
_currentModel.PlayIdleAnimation();
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Interact))
|
||||
{
|
||||
GetTree().Paused = true;
|
||||
BackButton.GrabFocus();
|
||||
}
|
||||
if (@event.IsActionPressed(GameInputs.Interact))
|
||||
{
|
||||
GetTree().Paused = true;
|
||||
BackButton.GrabFocus();
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.StrafeRight))
|
||||
{
|
||||
// Load next model
|
||||
_enemies[_currentIndex].Hide();
|
||||
if (_currentIndex == _enemies.Count - 1)
|
||||
_currentIndex = 0;
|
||||
else
|
||||
_currentIndex++;
|
||||
DisplayEnemy();
|
||||
}
|
||||
if (@event.IsActionPressed(GameInputs.StrafeLeft))
|
||||
{
|
||||
_enemies[_currentIndex].Hide();
|
||||
// Load previous model
|
||||
if (_currentIndex == 0)
|
||||
_currentIndex = _enemies.Count - 1;
|
||||
else
|
||||
_currentIndex--;
|
||||
DisplayEnemy();
|
||||
}
|
||||
if (@event.IsActionPressed(GameInputs.StrafeRight))
|
||||
{
|
||||
// Load next model
|
||||
_enemies[_currentIndex].Hide();
|
||||
if (_currentIndex == _enemies.Count - 1)
|
||||
_currentIndex = 0;
|
||||
else
|
||||
_currentIndex++;
|
||||
DisplayEnemy();
|
||||
}
|
||||
if (@event.IsActionPressed(GameInputs.StrafeLeft))
|
||||
{
|
||||
_enemies[_currentIndex].Hide();
|
||||
// Load previous model
|
||||
if (_currentIndex == 0)
|
||||
_currentIndex = _enemies.Count - 1;
|
||||
else
|
||||
_currentIndex--;
|
||||
DisplayEnemy();
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_currentModel == null || BackButton.HasFocus())
|
||||
return;
|
||||
if (_currentModel == null || BackButton.HasFocus())
|
||||
return;
|
||||
|
||||
var forwardStrength = Input.GetActionStrength(GameInputs.CameraForward);
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, _cameraSpeed * forwardStrength * (_cameraStartingPoint / 10));
|
||||
var backStrength = Input.GetActionStrength(GameInputs.CameraBack);
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -_cameraSpeed * backStrength * (_cameraStartingPoint / 10));
|
||||
var leftStrength = Input.GetActionStrength(GameInputs.MoveLeft);
|
||||
CameraPivot.RotateY(_cameraSpeed * leftStrength);
|
||||
var rightStrength = Input.GetActionStrength(GameInputs.MoveRight);
|
||||
CameraPivot.RotateY(-_cameraSpeed * rightStrength);
|
||||
var forwardStrength = Input.GetActionStrength(GameInputs.CameraForward);
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, _cameraSpeed * forwardStrength * (_cameraStartingPoint / 10));
|
||||
var backStrength = Input.GetActionStrength(GameInputs.CameraBack);
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -_cameraSpeed * backStrength * (_cameraStartingPoint / 10));
|
||||
var leftStrength = Input.GetActionStrength(GameInputs.MoveLeft);
|
||||
CameraPivot.RotateY(_cameraSpeed * leftStrength);
|
||||
var rightStrength = Input.GetActionStrength(GameInputs.MoveRight);
|
||||
CameraPivot.RotateY(-_cameraSpeed * rightStrength);
|
||||
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, _cameraStartingPoint / 2), new Vector3(0, 0, _cameraStartingPoint));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, _cameraStartingPoint / 2), new Vector3(0, 0, _cameraStartingPoint));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
|
||||
if (_currentModel is EnemyModelView2D enemyModelView2D)
|
||||
enemyModelView2D.SetCurrentDirection(_currentModel.GlobalBasis, -CameraPivot.Basis.Z);
|
||||
if (_currentModel is EnemyModelView2D enemyModelView2D)
|
||||
enemyModelView2D.SetCurrentDirection(_currentModel.GlobalBasis, -CameraPivot.Basis.Z);
|
||||
}
|
||||
|
||||
private void DisplayEnemy()
|
||||
{
|
||||
_currentModel = _enemies[_currentIndex];
|
||||
_currentModel = _enemies[_currentIndex];
|
||||
|
||||
var size = _currentModel.GetSize();
|
||||
if (_currentModel is EnemyModelView2D)
|
||||
_cameraStartingPoint = size.X / 50;
|
||||
else
|
||||
_cameraStartingPoint = size.X * 2;
|
||||
var size = _currentModel.GetSize();
|
||||
if (_currentModel is EnemyModelView2D)
|
||||
_cameraStartingPoint = size.X / 50;
|
||||
else
|
||||
_cameraStartingPoint = size.X * 2;
|
||||
|
||||
Camera3D.Position = new Vector3(Camera3D.Position.X, Camera3D.Position.Y, _cameraStartingPoint);
|
||||
EnemyName.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Name : "Placeholder Text";
|
||||
Description.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Description : "Placeholder Text";
|
||||
HPValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.MaximumHP : "Placeholder Text";
|
||||
ATKValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.ATK : "Placeholder Text";
|
||||
DEFValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.DEF : "Placeholder Text";
|
||||
Drop1Value.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Drop1 : "Placeholder Text";
|
||||
Drop2Value.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Drop2 : "Placeholder Text";
|
||||
AffinityValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Affinity : "Placeholder Text";
|
||||
WeaknessValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Weakness : "Placeholder Text";
|
||||
Camera3D.Position = new Vector3(Camera3D.Position.X, Camera3D.Position.Y, _cameraStartingPoint);
|
||||
EnemyName.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Name : "Placeholder Text";
|
||||
Description.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Description : "Placeholder Text";
|
||||
HPValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.MaximumHP : "Placeholder Text";
|
||||
ATKValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.ATK : "Placeholder Text";
|
||||
DEFValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.DEF : "Placeholder Text";
|
||||
Drop1Value.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Drop1 : "Placeholder Text";
|
||||
Drop2Value.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Drop2 : "Placeholder Text";
|
||||
AffinityValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Affinity : "Placeholder Text";
|
||||
WeaknessValue.Text = _currentModel.EnemyLoreInfo != null ? _currentModel.EnemyLoreInfo.Weakness : "Placeholder Text";
|
||||
|
||||
_enemies[_currentIndex].Show();
|
||||
_enemies[_currentIndex].Show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user