mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Rumia's patterns
This commit is contained in:
parent
6505c058a6
commit
a344ed8b72
12 changed files with 343 additions and 36 deletions
|
|
@ -180,23 +180,23 @@ public partial class ShootingPattern3D : AttackPattern
|
|||
Vector2 direction = pattern.BulletResource.Direction;
|
||||
|
||||
// TODO: Fix player aiming for 3D
|
||||
// if (pattern._targetPlayer && GameManager.Instance.PlayerPosition.HasValue)
|
||||
// {
|
||||
// if (pattern._predictPlayer && GameManager.Instance.PlayerVelocity.HasValue)
|
||||
// {
|
||||
// var predictedDirection = MathFunctions.PredictInterceptPosition(ScriptHost.ParentObject.GlobalPosition,
|
||||
// GameManager.Instance.PlayerPosition.Value, GameManager.Instance.PlayerVelocity.Value,
|
||||
// pattern.BulletResource.BulletSpeed);
|
||||
// if (predictedDirection.HasValue)
|
||||
// {
|
||||
// direction = (predictedDirection.Value - ScriptHost.ParentObject.GlobalPosition).Normalized();
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// direction = (GameManager.Instance.PlayerPosition.Value - ScriptHost.ParentObject.GlobalPosition).Normalized();
|
||||
// }
|
||||
// }
|
||||
if (pattern._targetPlayer && GameController.Instance.PlayerPosition.HasValue)
|
||||
{
|
||||
if (pattern._predictPlayer && GameController.Instance.PlayerVelocity.HasValue)
|
||||
{
|
||||
var predictedDirection = MathFunctions.PredictInterceptPosition(ScriptHost.ParentObject.GlobalPosition.ToVector2(),
|
||||
GameController.Instance.PlayerPosition.Value.ToVector2(), GameController.Instance.PlayerVelocity.Value.ToVector2(),
|
||||
pattern.BulletResource.BulletSpeed);
|
||||
if (predictedDirection.HasValue)
|
||||
{
|
||||
direction = (predictedDirection.Value - ScriptHost.ParentObject.GlobalPosition.ToVector2()).Normalized();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = (GameController.Instance.PlayerPosition.Value.ToVector2() - ScriptHost.ParentObject.GlobalPosition.ToVector2()).Normalized();
|
||||
}
|
||||
}
|
||||
|
||||
var spawnPosition = ScriptHost.ParentObject.GlobalPosition + pattern.EmitterOffset;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue