Tuesday, 19 August 2025 01:37:27
This commit is contained in:
22
Gameplay/Effects/Caffeinate.cs
Normal file
22
Gameplay/Effects/Caffeinate.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Caffeinate : Effect
|
||||
{
|
||||
public Caffeinate(Node2D OWNER) : base(OWNER)
|
||||
{
|
||||
_trigger.Add(Trigger.Collision);
|
||||
}
|
||||
|
||||
public override void TriggerEffect(Node TARGET = null)
|
||||
{
|
||||
if (TARGET is Worker)
|
||||
{
|
||||
Worker target = (Worker)TARGET;
|
||||
target._rotationalForce += 10;
|
||||
Vector2 targetDistanceNormal = (target.Position - _owner.Position).Normalized();
|
||||
target.ApplyCentralForce(targetDistanceNormal * 10);
|
||||
target.ChangeHealth(-1, _owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user