Skip to content

Commit

Permalink
#6: Implement drop item logic and fix inventory weapon slot display i…
Browse files Browse the repository at this point in the history
…ssue
  • Loading branch information
Danil Ko committed Mar 2, 2021
1 parent 9917f07 commit 24bbdb9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 26 deletions.
6 changes: 6 additions & 0 deletions agents/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ public void SetHUD(HUD hud, InventoryManager _inventoryManager)
// Setup Inventory UI
_inventoryUI = (InventoryUI)_hud.GetNode("controlGame/InventoryUI");
_inventoryUI.Initialize(_inventoryManager, CurrentInventory);


if (!_teamMapAI.IsConnected(nameof(TeamMapAI.TeamUnitUsageAmountChangeSignal), _hud, nameof(HUD.UpdateTeamUnitUsageAmount)))
{
_teamMapAI.Connect(nameof(TeamMapAI.TeamUnitUsageAmountChangeSignal), _hud, nameof(HUD.UpdateTeamUnitUsageAmount));
}
}

protected override void DisconnectWeapon(Weapon currentWeapon, Weapon.WeaponOrder weaponOrder)
Expand Down
4 changes: 2 additions & 2 deletions ai/TeamMapAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
public class TeamMapAI : Node2D
{
[Signal]
public delegate void TeamUnitUsageAmount();
public delegate void TeamUnitUsageAmountChangeSignal();

enum BaseCaptureStartOrder
{
Expand Down Expand Up @@ -77,7 +77,7 @@ public bool ChargeAmount(int chargeAmount)
else
{
_currentUnitUsageAmount = _currentUnitUsageAmount - chargeAmount;
EmitSignal(nameof(TeamUnitUsageAmount), _currentUnitUsageAmount);
EmitSignal(nameof(TeamUnitUsageAmountChangeSignal), _currentUnitUsageAmount);
return true;
}
}
Expand Down
34 changes: 17 additions & 17 deletions projectiles/LaserRay.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,46 @@
[ext_resource path="res://assets/ui/blue_circle.png" type="Texture" id=2]
[ext_resource path="res://assets/ui/blue_tick.png" type="Texture" id=3]

[sub_resource type="Gradient" id=4]
[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.688222 )
colors = PoolColorArray( 0.5, 6, 9, 0.98, 1, 1, 1, 0 )

[sub_resource type="GradientTexture" id=5]
gradient = SubResource( 4 )
[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )

[sub_resource type="Curve" id=6]
[sub_resource type="Curve" id=3]
_data = [ Vector2( 0, 0.976136 ), 0.0, -0.0740261, 0, 0, Vector2( 0.502193, 0.976136 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -1.36878, -1.36878, 0, 0 ]

[sub_resource type="CurveTexture" id=7]
curve = SubResource( 6 )
[sub_resource type="CurveTexture" id=4]
curve = SubResource( 3 )

[sub_resource type="ParticlesMaterial" id=8]
[sub_resource type="ParticlesMaterial" id=5]
flag_disable_z = true
gravity = Vector3( 0, 0, 0 )
initial_velocity = 120.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale = 0.5
scale_curve = SubResource( 7 )
color_ramp = SubResource( 5 )
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )

[sub_resource type="ParticlesMaterial" id=9]
[sub_resource type="ParticlesMaterial" id=6]
flag_disable_z = true
gravity = Vector3( 0, 0, 0 )
initial_velocity = 250.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
scale = 0.5
scale_curve = SubResource( 7 )
color_ramp = SubResource( 5 )
scale_curve = SubResource( 4 )
color_ramp = SubResource( 2 )

[sub_resource type="ParticlesMaterial" id=3]
[sub_resource type="ParticlesMaterial" id=7]
emission_shape = 2
emission_box_extents = Vector3( 20, 20, 0 )
direction = Vector3( 0, 0, 0 )
gravity = Vector3( 0, 0, 0 )
linear_accel = 10.0
scale = 5.0
scale = 0.5
color = Color( 0.5, 3, 6, 1 )

[node name="LaserRay" type="RayCast2D"]
Expand All @@ -63,17 +63,17 @@ default_color = Color( 0.5, 3, 6, 1 )
[node name="particles2DCasting" type="Particles2D" parent="."]
emitting = false
lifetime = 0.5
process_material = SubResource( 8 )
process_material = SubResource( 5 )
texture = ExtResource( 2 )

[node name="particles2DCollision" type="Particles2D" parent="."]
emitting = false
lifetime = 0.5
process_material = SubResource( 9 )
process_material = SubResource( 6 )
texture = ExtResource( 2 )

[node name="particles2DBeam" type="Particles2D" parent="."]
emitting = false
amount = 20
process_material = SubResource( 3 )
process_material = SubResource( 7 )
texture = ExtResource( 3 )
5 changes: 5 additions & 0 deletions ui/HUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ private void _onAnimationPlayerFinished(String animationName)
}
}

public void UpdateTeamUnitUsageAmount(int cost)
{
((Label)GetNode("lblTeamUnitUsageAmount")).Text = "" + cost;
}

private void _onUpdateTimer(String message)
{
if (message.Contains("00:00:"))
Expand Down
17 changes: 14 additions & 3 deletions ui/HUD.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ script = ExtResource( 1 )
[node name="lblTimerStatus" type="Label" parent="."]
margin_left = 25.0
margin_top = 552.0
margin_right = 568.0
margin_right = 322.0
margin_bottom = 577.0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.588235, 1, 0.356863, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="lblTeamUnitUsageAmount" type="Label" parent="."]
margin_left = 447.0
margin_top = 552.0
margin_right = 683.0
margin_bottom = 577.0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.588235, 1, 0.356863, 1 )
Expand Down Expand Up @@ -97,9 +108,9 @@ __meta__ = {
}

[node name="lblNetworkRate" type="Label" parent="."]
margin_left = 482.095
margin_left = 516.582
margin_top = 580.087
margin_right = 645.095
margin_right = 679.582
margin_bottom = 595.087
__meta__ = {
"_edit_use_anchors_": false
Expand Down
4 changes: 2 additions & 2 deletions weapons/LaserGun.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ script = ExtResource( 4 )
CurrentWeaponType = 1
KnockbackForce = 10.0
ItemResourceID = "SYC-1000"
MaxAmmo = 5
MaxAmmo = 10
CooldownTime = 0.5
ReloadTime = 10.0
ReloadTime = 5.0

[node name="TriggerPoint" parent="." index="1"]
position = Vector2( 80, 0 )
Expand Down
4 changes: 2 additions & 2 deletions weapons/MissleLauncher.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CurrentWeaponAmmoType = 1
CurrentWeaponType = 2
KnockbackForce = 200.0
ItemResourceID = "SYC-300"
MaxAmmo = 10
MaxAmmo = 20
CooldownTime = 0.5
ReloadTime = 3.0
ReloadTime = 2.0
Bullet = ExtResource( 4 )

[node name="TriggerPoint" parent="." index="1"]
Expand Down

0 comments on commit 24bbdb9

Please sign in to comment.