Friday, 22 August 2025 01:17:08
This commit is contained in:
@@ -21,8 +21,8 @@ public partial class BasicAttack : Action
|
||||
Worker owner = (Worker)_owner;
|
||||
if (target._manager != owner._manager)
|
||||
{
|
||||
int damage = -owner._aptitude / 2;
|
||||
target.ChangeHealth(damage, owner);
|
||||
int damage = -owner._aptitude._default / 2;
|
||||
// target.ChangeHealth(damage, owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@ public partial class Caffeinate : Action
|
||||
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);
|
||||
if (!target.HasCondition(GetType().ToString()))
|
||||
{
|
||||
target._conditions.Add(new Caffeinated(target));
|
||||
}
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ using System.Collections.Generic;
|
||||
|
||||
public partial class Condition : Node
|
||||
{
|
||||
public bool _canExpire;
|
||||
public bool _canExpire, _expired;
|
||||
public int _countdown;
|
||||
public Timer _timer = new();
|
||||
public Node _target;
|
||||
public List<Trigger.On> _triggers = new();
|
||||
public List<Trigger.On> _expirations = new();
|
||||
|
||||
36
Gameplay/Conditions/Caffeinated.cs
Normal file
36
Gameplay/Conditions/Caffeinated.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Caffeinated : Condition
|
||||
{
|
||||
public Caffeinated(Node2D OWNER) : base(OWNER)
|
||||
{
|
||||
_triggers.Add(Trigger.On.Time);
|
||||
_countdown = 2;
|
||||
_timer.OneShot = true;
|
||||
_timer.WaitTime = _countdown;
|
||||
_timer.Autostart = true;
|
||||
AddChild(_timer);
|
||||
// GetNode<Timer>("Timer").Timeout += Fire;
|
||||
if (OWNER is Worker)
|
||||
{
|
||||
((Worker)OWNER)._staminaCanDrain = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Fire()
|
||||
{
|
||||
_expired = true;
|
||||
if (_target != null)
|
||||
{
|
||||
if (_target is Worker)
|
||||
{
|
||||
Worker target = (Worker)_target;
|
||||
target._stamina -= 1;
|
||||
target._staminaCanDrain = true;
|
||||
target._conditions.Remove(this);
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Gameplay/Conditions/Caffeinated.cs.uid
Normal file
1
Gameplay/Conditions/Caffeinated.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ciwja82k4ihw6
|
||||
@@ -16,7 +16,7 @@ public partial class Spiky : Condition
|
||||
{
|
||||
Worker target = (Worker)_target;
|
||||
target._rotationalForce += 10;
|
||||
target.ChangeHealth(-1, _owner);
|
||||
// target.ChangeHealth(-1, _owner);
|
||||
}
|
||||
_target = null;
|
||||
}
|
||||
|
||||
6
Gameplay/Conditions/caffeinated.tscn
Normal file
6
Gameplay/Conditions/caffeinated.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dtnwf7i53hix6"]
|
||||
|
||||
[ext_resource type="Script" path="res://Gameplay/Effects/Spiky.cs" id="1_pcknv"]
|
||||
|
||||
[node name="Spiky" type="Node"]
|
||||
script = ExtResource("1_pcknv")
|
||||
@@ -27,22 +27,20 @@ public partial class Manager : Node
|
||||
|
||||
Worker newWorker = Globals.Instance._workerScene.Instantiate<Worker>();
|
||||
newWorker.Position = Globals.Instance._screenCenter + new Vector2(0, 100);
|
||||
newWorker._id = 1;
|
||||
newWorker._manager = this;
|
||||
AddChild(newWorker);
|
||||
_workers.Add(newWorker);
|
||||
|
||||
newWorker = Globals.Instance._workerScene.Instantiate<Worker>();
|
||||
newWorker.Position = Globals.Instance._screenCenter - new Vector2(0, 100);
|
||||
newWorker._id = 2;
|
||||
newWorker._manager = this;
|
||||
AddChild(newWorker);
|
||||
_workers.Add(newWorker);
|
||||
|
||||
for (int i = 0; i < _workers.Count; i++)
|
||||
{
|
||||
_workers[i]._healthBar.Position = _managerPanel.GetNode<Panel>("Team").GetNode<Panel>("T"+(i+1)).GlobalPosition;
|
||||
}
|
||||
// for (int i = 0; i < _workers.Count; i++)
|
||||
// {
|
||||
// _workers[i]._healthBar.Position = _managerPanel.GetNode<Panel>("Team").GetNode<Panel>("T"+(i+1)).GlobalPosition;
|
||||
// }
|
||||
|
||||
Tchotchke newTchotchke = ResourceLoader.Load<PackedScene>("res://Gameplay/Tchotchkes/awfully_hot_coffee_pot.tscn").Instantiate<Tchotchke>();
|
||||
newTchotchke.Position = new Vector2(Globals.Instance._screenSize.X - 100, Globals.Instance._screenCenter.Y);
|
||||
|
||||
8
Gameplay/Stat.cs
Normal file
8
Gameplay/Stat.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Stat : Node
|
||||
{
|
||||
public int _default, _effective;
|
||||
|
||||
}
|
||||
1
Gameplay/Stat.cs.uid
Normal file
1
Gameplay/Stat.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dqthihtgdvrx8
|
||||
@@ -1,38 +1,47 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Worker : RigidBody2D
|
||||
{
|
||||
public bool _dead = false, _hovered = false, _held = false, _placed = false, _selected = false, _primed = false, _moving = false;
|
||||
public int _health, _healthMax, _aptitude, _agility, _ardor, _accumen, _awareness, _appeal, _id;
|
||||
public bool _dead = false, _hovered = false, _held = false, _placed = false, _selected = false, _primed = false, _moving = false, _staminaCanDrain = true;
|
||||
public int _health, _healthMax;
|
||||
public float _stamina, _staminaMax;
|
||||
public Stat _aptitude = new(), _agility = new(), _ardor = new(), _accumen = new(), _awareness = new(), _appeal = new();
|
||||
public float _rotationalForce = 0;
|
||||
public Vector2 _force = Vector2.Zero;
|
||||
public Node _collisionTarget;
|
||||
public Sprite2D _image;
|
||||
public ProgressBar _healthBar;
|
||||
public Manager _manager;
|
||||
public List<Action> _Actions = new();
|
||||
public List<Action> _actions = new();
|
||||
public List<Condition> _conditions = new();
|
||||
public override void _Ready()
|
||||
{
|
||||
_health = 10;
|
||||
_aptitude = 5;
|
||||
_agility = 5;
|
||||
_ardor = 5;
|
||||
_accumen = 5;
|
||||
_awareness = 5;
|
||||
_appeal = 5;
|
||||
_aptitude._default = 5;
|
||||
_agility._default = 5;
|
||||
_ardor._default = 5;
|
||||
_accumen._default = 5;
|
||||
_awareness._default = 5;
|
||||
_appeal._default = 5;
|
||||
|
||||
_aptitude._effective = _aptitude._default;
|
||||
_agility._effective = _agility._default;
|
||||
_ardor._effective = _ardor._default;
|
||||
_accumen._effective = _accumen._default;
|
||||
_awareness._effective = _awareness._default;
|
||||
_appeal._effective = _appeal._default;
|
||||
|
||||
_healthMax = _health;
|
||||
_image = GetNode<Sprite2D>("Sprite2D");
|
||||
|
||||
_Actions.Add(new BasicAttack(this));
|
||||
_actions.Add(new BasicAttack(this));
|
||||
|
||||
_healthBar = GetNode<ProgressBar>("HealthBar");
|
||||
_healthBar.MaxValue = _healthMax;
|
||||
_healthBar.Value = _health;
|
||||
// _healthBar = GetNode<ProgressBar>("HealthBar");
|
||||
// _healthBar.MaxValue = _healthMax;
|
||||
// _healthBar.Value = _health;
|
||||
}
|
||||
|
||||
public override void _Process(double DELTA_)
|
||||
@@ -62,7 +71,7 @@ public partial class Worker : RigidBody2D
|
||||
{
|
||||
_selected = false;
|
||||
_force = (GlobalPosition - mousePosition) * 100;
|
||||
_rotationalForce = 5f;
|
||||
_stamina = _agility._effective;
|
||||
_primed = true;
|
||||
}
|
||||
}
|
||||
@@ -79,9 +88,12 @@ public partial class Worker : RigidBody2D
|
||||
{
|
||||
// Vector2 towardCenter = (Globals.Instance._screenCenter - GlobalPosition).Normalized();
|
||||
// ApplyCentralForce(towardCenter * 100);
|
||||
_image.Rotate(_rotationalForce);
|
||||
_rotationalForce -= 0.5f / 60;
|
||||
if (_rotationalForce <= 0f)
|
||||
_image.Rotate(_stamina);
|
||||
if (_staminaCanDrain)
|
||||
{
|
||||
_stamina -= 0.25f / 60;
|
||||
}
|
||||
if (_stamina <= 0f)
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
@@ -121,7 +133,6 @@ public partial class Worker : RigidBody2D
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Drop()
|
||||
{
|
||||
if (_held)
|
||||
@@ -132,6 +143,24 @@ public partial class Worker : RigidBody2D
|
||||
}
|
||||
}
|
||||
|
||||
public void FireActions(Trigger.On TRIGGER, Node TARGET = null)
|
||||
{
|
||||
List<Action> triggeredActions = _actions.Where(e => e._triggers.Contains(TRIGGER)).ToList();
|
||||
for (int i = 0; i < triggeredActions.Count; i++)
|
||||
{
|
||||
triggeredActions[i].Target(TARGET);
|
||||
triggeredActions[i].Fire();
|
||||
}
|
||||
List<Action> expiredActions = _actions.Where(e => e._triggers.Contains(TRIGGER)).ToList();
|
||||
_actions.Except(expiredActions);
|
||||
}
|
||||
|
||||
public bool HasCondition(string CONDITION)
|
||||
{
|
||||
List<string> conditionNames = _conditions.Select(c => c.GetType().ToString()).ToList();
|
||||
return conditionNames.Contains(CONDITION);
|
||||
}
|
||||
|
||||
public void Hold()
|
||||
{
|
||||
if (_held)
|
||||
@@ -157,20 +186,18 @@ public partial class Worker : RigidBody2D
|
||||
GravityScale = 0.0f;
|
||||
Sleeping = true;
|
||||
_moving = false;
|
||||
_rotationalForce = 0f;
|
||||
_stamina = 0f;
|
||||
FireActions(Trigger.On.Stop, _manager);
|
||||
}
|
||||
|
||||
public void FireActions(Trigger.On TRIGGER, Node TARGET = null)
|
||||
public void ResetStats()
|
||||
{
|
||||
List<Action> triggeredActions = _Actions.Where(e => e._triggers.IndexOf(TRIGGER) > -1).ToList();
|
||||
for (int i = 0; i < triggeredActions.Count; i++)
|
||||
{
|
||||
triggeredActions[i].Target(TARGET);
|
||||
triggeredActions[i].Fire();
|
||||
}
|
||||
List<Action> expiredActions = _Actions.Where(e => e._triggers.IndexOf(TRIGGER) > -1).ToList();
|
||||
_Actions.Except(expiredActions);
|
||||
_aptitude._effective = _aptitude._default;
|
||||
_agility._effective = _agility._default;
|
||||
_ardor._effective = _ardor._default;
|
||||
_accumen._effective = _accumen._default;
|
||||
_awareness._effective = _awareness._default;
|
||||
_appeal._effective = _appeal._default;
|
||||
}
|
||||
|
||||
// PRIVATE METHODS
|
||||
|
||||
@@ -2,29 +2,28 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://w4cxyhjvmkq1" path="res://art/desk.png" id="1_21bwm"]
|
||||
[ext_resource type="Script" uid="uid://pxi753iie75t" path="res://Gameplay/Desk.cs" id="2_15p4t"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_fw0uc"]
|
||||
radius = 88.5
|
||||
height = 566.0
|
||||
[ext_resource type="Texture2D" uid="uid://c5yof13kvayxo" path="res://art/deskBounds.png" id="3_15p4t"]
|
||||
|
||||
[node name="Desk" type="Sprite2D"]
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_21bwm")
|
||||
script = ExtResource("2_15p4t")
|
||||
|
||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D"]
|
||||
visible = false
|
||||
texture = ExtResource("3_15p4t")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"]
|
||||
polygon = PackedVector2Array(34.5, -87.5, 60.5, -87.5, 131.5, -87, 245, -78.5, 251, -77, 265, -55.5, 273, -16, 272.5, 0.5, 269.5, 31, 264, 58, 251, 76, 220.5, 81.5, 144, 85, 54, 87, 0, 87, -88.5, 85, -167, 84.5, -246, 77.5, -260, 62.5, -271.5, 22.5, -272, -0.5, -271.5, -25.5, -266, -47, -257, -70.5, -248, -79, -186.5, -84, -105, -87, -17.5, -87.5, 34.5, -87.5, 35, -335, -418.5, -337, -421, 448, 439, 445, 438.5, -357.5, 35, -334.5)
|
||||
polygon = PackedVector2Array(750, -750, 1, -750, 1, -373.1, 157, -370, 163.1, -370, 252.1, -337, 253.2, -337, 288.3, -310, 289.7, -310, 333.7, -258, 359.8, -203, 371, -152, 373, -131.6, 373, 131.3, 367, 174.7, 367, 179.1, 351, 224.1, 351, 226.4, 310, 288.5, 310, 289.7, 257.9, 333.7, 194.1, 362.7, 127, 372.7, -131.4, 373, -217.5, 354, -219.6, 354, -265.7, 328, -267.1, 328, -317, 281, -352.2, 223, -369.1, 165.8, -372, -132, -372, -147.4, -359, -204.4, -359, -206.9, -328, -265.8, -328, -266.9, -264.1, -329.9, -194.2, -362.8, -127, -372.7, 0, -373, 0, -750, -750, -750, -750, 750, 750, 750)
|
||||
|
||||
[node name="Gravity" type="Area2D" parent="."]
|
||||
visible = false
|
||||
gravity_space_override = 1
|
||||
gravity_point = true
|
||||
gravity_point_unit_distance = 375.0
|
||||
gravity_point_center = Vector2(0, 0)
|
||||
gravity_direction = Vector2(0, 0)
|
||||
gravity = 100.0
|
||||
gravity = 5.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Gravity"]
|
||||
rotation = 1.5708
|
||||
shape = SubResource("CapsuleShape2D_fw0uc")
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Gravity"]
|
||||
polygon = PackedVector2Array(157.2, -375, -153, -375, -174.3, -372, -179.3, -372, -218.3, -359, -221.5, -359, -256.6, -340, -258.7, -340, -285.7, -319, -287.8, -319, -316.8, -289, -318.1, -289, -341.1, -255, -342.3, -255, -359.3, -218, -360.5, -218, -370.5, -181, -371.8, -181, -375, -154.6, -375, 160.5, -368, 191, -368, 195.4, -356, 225.4, -356, 228.6, -332, 268.5, -332, 270.7, -312, 293.7, -312, 295.9, -284, 320.8, -284, 322.1, -248, 345.1, -248, 346.3, -218, 359.2, -218, 360.5, -197, 366.4, -197, 367.7, -165, 373.7, -165, 374.8, -163.3, 375, 157.4, 375, 174.4, 372, 179.3, 372, 218.3, 359, 221.5, 359, 256.6, 340, 258.7, 340, 293.7, 312, 295.9, 312, 316.9, 289, 318.1, 289, 341.1, 255, 342.3, 255, 357.2, 223, 358.5, 223, 370.5, 181, 371.8, 181, 375, 154.6, 375, -163.2, 368, -191, 368, -195.4, 356, -225.5, 356, -228.6, 332, -268.6, 332, -270.7, 312, -293.8, 312, -295.9, 284, -320.9, 284, -322.1, 248, -345.2, 248, -346.3, 218, -359.3, 218, -360.6, 171, -372.6, 171, -373.8)
|
||||
|
||||
6
Gameplay/stat.tscn
Normal file
6
Gameplay/stat.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b8rfuerwno7h1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dqthihtgdvrx8" path="res://Gameplay/Stat.cs" id="1_kb7kj"]
|
||||
|
||||
[node name="Stat" type="Node"]
|
||||
script = ExtResource("1_kb7kj")
|
||||
@@ -1 +0,0 @@
|
||||
uid://c1bvlokuaveb2
|
||||
BIN
art/desk.png
BIN
art/desk.png
Binary file not shown.
|
Before Width: | Height: | Size: 147 KiB After Width: | Height: | Size: 23 KiB |
BIN
art/deskBounds.png
Normal file
BIN
art/deskBounds.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
34
art/deskBounds.png.import
Normal file
34
art/deskBounds.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c5yof13kvayxo"
|
||||
path="res://.godot/imported/deskBounds.png-fa23ed94e8b4e04910d1a67af27f113b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://art/deskBounds.png"
|
||||
dest_files=["res://.godot/imported/deskBounds.png-fa23ed94e8b4e04910d1a67af27f113b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user