token manager for projectile
This commit is contained in:
@@ -5,11 +5,12 @@ using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||
using Godot;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.managers;
|
||||
using Movementtests.tools;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public record OnProjectileSpawned(Vector3 Direction, float SpeedMultiplier, Vector3? SpawnOffset = null, uint? CollisionOverride = null);
|
||||
public record OnProjectileSpawned(Vector3 Direction, float SpeedMultiplier, Vector3? SpawnOffset = null, uint? CollisionOverride = null, TokenManager.Token? Token = null);
|
||||
|
||||
public class SpawnProjectileBehavior(PackedScene projectileScene) : IAbilityBehavior<OnProjectileSpawned>
|
||||
{
|
||||
@@ -31,13 +32,12 @@ public class SpawnProjectileBehavior(PackedScene projectileScene) : IAbilityBeha
|
||||
var impulse = data.Direction * data.SpeedMultiplier * magnitude;
|
||||
var collisionOverride = data.CollisionOverride ?? projectile.CollisionMask;
|
||||
|
||||
GD.Print(impulse);
|
||||
|
||||
// Setting up projectile
|
||||
projectile.GlobalPosition = startPos + offset;
|
||||
projectile.Target = target;
|
||||
projectile.ImpulseDirection = impulse;
|
||||
projectile.CollisionMask = collisionOverride;
|
||||
projectile.Token = data.Token;
|
||||
|
||||
if (projectile is ISpawnable spawnable) spawnable.Init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user