Wednesday, 20 August 2025 02:02:40
This commit is contained in:
35
Gameplay/Actions/BasicAttack.cs
Normal file
35
Gameplay/Actions/BasicAttack.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class BasicAttack : Action
|
||||
{
|
||||
public BasicAttack(Node2D OWNER) : base(OWNER)
|
||||
{
|
||||
_triggers.Add(Trigger.On.Collision);
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
if (_target != null)
|
||||
{
|
||||
if (_target is Worker)
|
||||
{
|
||||
Worker target = (Worker)_target;
|
||||
if (_owner is Worker)
|
||||
{
|
||||
Worker owner = (Worker)_owner;
|
||||
if (target._manager != owner._manager)
|
||||
{
|
||||
int damage = -owner._aptitude / 2;
|
||||
target.ChangeHealth(damage, owner);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Gameplay/Actions/BasicAttack.cs.uid
Normal file
1
Gameplay/Actions/BasicAttack.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://2ilonmgvkayp
|
||||
26
Gameplay/Actions/Caffeinate.cs
Normal file
26
Gameplay/Actions/Caffeinate.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Caffeinate : Action
|
||||
{
|
||||
public Caffeinate(Node2D OWNER) : base(OWNER)
|
||||
{
|
||||
_triggers.Add(Trigger.On.Collision);
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
if (_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);
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Gameplay/Actions/Caffeinate.cs.uid
Normal file
1
Gameplay/Actions/Caffeinate.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cbk76ik5o17nx
|
||||
3
Gameplay/Actions/basic_attack.tscn
Normal file
3
Gameplay/Actions/basic_attack.tscn
Normal file
@@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://bih70e65g1108"]
|
||||
|
||||
[node name="BasicAttack" type="Node"]
|
||||
6
Gameplay/Actions/caffeinate.tscn
Normal file
6
Gameplay/Actions/caffeinate.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bo2rj0albmkkw"]
|
||||
|
||||
[ext_resource type="Script" path="res://Gameplay/Effects/Caffeinate.cs" id="1_l8me6"]
|
||||
|
||||
[node name="Caffeinate" type="Node"]
|
||||
script = ExtResource("1_l8me6")
|
||||
Reference in New Issue
Block a user