mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Grahpics overhaul and predicting bullets
This commit is contained in:
parent
24386e724f
commit
946e7df71e
14 changed files with 144 additions and 26 deletions
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using Cirno.Scripts.Actors;
|
||||
using Cirno.Scripts.Components;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Utils;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Array = System.Array;
|
||||
|
|
@ -36,6 +37,7 @@ public partial class SpiralPattern : AttackPattern
|
|||
// [ExportGroup("Modifiers")] [Export] private BulletCreationModifier _modifier;
|
||||
// [ExportGroup("Modifiers")] [Export] private Array<TimeModifier> _timeModifiers;
|
||||
[ExportCategory("Other")] [Export] public bool _targetPlayer = false;
|
||||
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
|
||||
|
||||
[ExportCategory("Overrides")]
|
||||
[Export] public bool OverrideOwner { get; private set; } = false;
|
||||
|
|
@ -224,7 +226,20 @@ public partial class SpiralPattern : AttackPattern
|
|||
|
||||
if (pattern._targetPlayer && GameManager.Instance.PlayerPosition.HasValue)
|
||||
{
|
||||
direction = (GameManager.Instance.PlayerPosition.Value - Parent.GlobalPosition).Normalized();
|
||||
if (pattern._predictPlayer && GameManager.Instance.PlayerVelocity.HasValue)
|
||||
{
|
||||
var predictedDirection = MathFunctions.PredictInterceptPosition(Parent.GlobalPosition,
|
||||
GameManager.Instance.PlayerPosition.Value, GameManager.Instance.PlayerVelocity.Value,
|
||||
pattern.BulletResource.BulletSpeed);
|
||||
if (predictedDirection.HasValue)
|
||||
{
|
||||
direction = (predictedDirection.Value - Parent.GlobalPosition).Normalized();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = (GameManager.Instance.PlayerPosition.Value - Parent.GlobalPosition).Normalized();
|
||||
}
|
||||
}
|
||||
|
||||
var bullet = pattern.MakeBullet(Parent.GlobalPosition, pattern.bulletCount,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue