Add plastique item
Add Door object Initial work for look up animation
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ShakeCamera : Camera3D
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Export] private double _shakeIntensity = 1.0;
|
||||
|
||||
[Export] private double _maxX = 10;
|
||||
@@ -18,28 +24,28 @@ public partial class ShakeCamera : Camera3D
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_initialRotation = RotationDegrees;
|
||||
_initialRotation = RotationDegrees;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_time += delta;
|
||||
_shake = Mathf.Max(_shake - delta * _shakeIntensity, 0.0);
|
||||
_time += delta;
|
||||
_shake = Mathf.Max(_shake - delta * _shakeIntensity, 0.0);
|
||||
|
||||
RotationDegrees = new Vector3(
|
||||
(float)(_initialRotation.X + _maxX * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(0)),
|
||||
(float)(_initialRotation.Y + _maxY * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(1)),
|
||||
(float)(_initialRotation.Z + _maxZ * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(2)));
|
||||
RotationDegrees = new Vector3(
|
||||
(float)(_initialRotation.X + _maxX * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(0)),
|
||||
(float)(_initialRotation.Y + _maxY * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(1)),
|
||||
(float)(_initialRotation.Z + _maxZ * Mathf.Pow(_shake, 2) * GetNoiseFromSeed(2)));
|
||||
}
|
||||
|
||||
public void AddShake(float shakeAmount)
|
||||
{
|
||||
_shake = Mathf.Clamp(_shake + shakeAmount, 0.0, 1.0);
|
||||
_shake = Mathf.Clamp(_shake + shakeAmount, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private double GetNoiseFromSeed(int seed)
|
||||
{
|
||||
_noise.Seed = seed;
|
||||
return _noise.GetNoise1D((float)(_time * _noiseSpeed));
|
||||
_noise.Seed = seed;
|
||||
return _noise.GetNoise1D((float)(_time * _noiseSpeed));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user