23 lines
588 B
C#
23 lines
588 B
C#
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);
|
|
}
|
|
}
|
|
}
|