Skip to content

Commit

Permalink
#6: Fix basic assignment weapon assignment and utilize inventory system
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Ko committed Mar 2, 2021
1 parent 6421fa9 commit d8c0eab
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 63 deletions.
2 changes: 1 addition & 1 deletion agents/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ protected virtual void ConnectWeapon(Weapon currentWeapon, Weapon.WeaponOrder we
// If the current weapon ammo is 0, then notify about out of ammo
if (currentWeapon.getAmmo() == 0)
{
currentWeapon.EmitSignal(nameof(Weapon.AmmoOutSignal));
currentWeapon.EmitSignal(nameof(Weapon.AmmoOutSignal), weaponOrder);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ai/TeamMapAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ private void _assignDefaultWeapon(Agent agent)
// Add default wepaons
_inventoryManager.AddItem(_inventoryManager.GetPurchasableItemByID("SYC-600"), agent.GetInventory());
_inventoryManager.AddItem(_inventoryManager.GetPurchasableItemByID("SYC-800"), agent.GetInventory());
// TODO: There is bug with shield that will push agent back
// _inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-600"), Weapon.WeaponOrder.Left, 0);

_inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-600"), Weapon.WeaponOrder.Right, 0);
_inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-800"), Weapon.WeaponOrder.Left, 0);
}

Expand Down
4 changes: 1 addition & 3 deletions map/SimulateGameWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ public void changeAgentBehavior()
continue;
}

enemyNode.setHealth(100);
enemyNode.changeWeapon(random.RandiRange(0, 100), Weapon.WeaponOrder.Left);
enemyNode.changeWeapon(random.RandiRange(0, 100), Weapon.WeaponOrder.Right);
enemyNode.Heal(100);
spawnBotTargetBase[enemyNode.GetUnitName()] = (spawnBotTargetBase[enemyNode.GetUnitName()] + 1) % _capaturableBaseManager.GetBases().Count;
}
}
Expand Down
2 changes: 1 addition & 1 deletion map/SimulateGameWorld.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ position = Vector2( -572.239, 298.437 )
_defaultTeamCode = 1

[node name="ChangeAgentBehavior" type="Timer" parent="."]
wait_time = 5.0
wait_time = 2.0
autostart = true

[node name="GameCamera" parent="." instance=ExtResource( 9 )]
Expand Down
40 changes: 19 additions & 21 deletions projectiles/LaserRay.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +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=1]
[sub_resource type="Gradient" id=4]
offsets = PoolRealArray( 0, 0.688222 )
colors = PoolColorArray( 0.5, 6, 9, 0.98, 1, 1, 1, 0 )

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

[sub_resource type="Curve" id=3]
[sub_resource type="Curve" id=6]
_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=4]
curve = SubResource( 3 )
[sub_resource type="CurveTexture" id=7]
curve = SubResource( 6 )

[sub_resource type="ParticlesMaterial" id=5]
[sub_resource type="ParticlesMaterial" id=8]
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( 4 )
color_ramp = SubResource( 2 )
scale_curve = SubResource( 7 )
color_ramp = SubResource( 5 )

[sub_resource type="ParticlesMaterial" id=6]
[sub_resource type="ParticlesMaterial" id=9]
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( 4 )
color_ramp = SubResource( 2 )
scale_curve = SubResource( 7 )
color_ramp = SubResource( 5 )

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

[node name="LaserRay" type="RayCast2D"]
Expand All @@ -65,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( 5 )
process_material = SubResource( 8 )
texture = ExtResource( 2 )

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

[node name="particles2DBeam" type="Particles2D" parent="."]
emitting = false
amount = 20
process_material = SubResource( 7 )
process_material = SubResource( 3 )
texture = ExtResource( 3 )
52 changes: 19 additions & 33 deletions projectiles/RifileBullet.tscn
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=7 format=2]

[ext_resource path="res://projectiles/Projectile.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/allSprites_retina_rotated.png" type="Texture" id=2]
[ext_resource path="res://projectiles/RifileBullet.cs" type="Script" id=3]

[sub_resource type="CanvasItemMaterial" id=10]
[sub_resource type="CanvasItemMaterial" id=1]
blend_mode = 1

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 25.1463, 9.0589 )
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 29.4785, 6.02488 )

[sub_resource type="Gradient" id=7]
colors = PoolColorArray( 1, 0.964706, 0.784314, 0.501961, 1, 1, 1, 0.45098 )

[sub_resource type="GradientTexture" id=8]
gradient = SubResource( 7 )

[sub_resource type="Curve" id=11]
max_value = 100.0
_data = [ Vector2( 0, 100 ), 0.0, -97.2727, 0, 1, Vector2( 1, 2.72727 ), 50.7263, 0.0, 0, 0 ]

[sub_resource type="CurveTexture" id=12]
curve = SubResource( 11 )

[sub_resource type="ParticlesMaterial" id=9]
flag_disable_z = true
[sub_resource type="ParticlesMaterial" id=3]
emission_shape = 2
emission_box_extents = Vector3( 20, 20, 0 )
direction = Vector3( 0, 0, 0 )
spread = 0.0
gravity = Vector3( 0, 0, 0 )
initial_velocity = -100.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
linear_accel = 100.0
linear_accel_curve = SubResource( 12 )
scale = 15.0
color_ramp = SubResource( 8 )
linear_accel = 10.0
scale = 5.0
color = Color( 0.5, 3, 6, 1 )

[node name="RifileBullet" instance=ExtResource( 1 )]
script = ExtResource( 3 )
Expand All @@ -43,18 +26,21 @@ Damage = 10
Lifetime = 5.0

[node name="Sprite" parent="." index="0"]
self_modulate = Color( 73.99, 1, 1, 1 )
material = SubResource( 10 )
self_modulate = Color( 0.78, 29.66, 23.12, 1 )
material = SubResource( 1 )
rotation = 3.14159
scale = Vector2( 1, 0.5 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 600, 46, 50, 15 )
region_rect = Rect2( 541, 42, 58, 22 )

[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource( 1 )
shape = SubResource( 2 )

[node name="Particles2D" type="Particles2D" parent="." index="4"]
amount = 5
visible = false
rotation = -1.5708
amount = 3
lifetime = 2.0
speed_scale = 5.0
process_material = SubResource( 9 )
process_material = SubResource( 3 )
4 changes: 2 additions & 2 deletions weapons/Rifile.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ tracks/1/keys = {
script = ExtResource( 2 )
KnockbackForce = 10.0
ItemResourceID = "SYC-800"
MaxAmmo = 50
CooldownTime = 0.1
MaxAmmo = 100
CooldownTime = 0.125
ReloadTime = 2.0
Bullet = ExtResource( 4 )

Expand Down
2 changes: 2 additions & 0 deletions weapons/Shield.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CooldownTime = 1.0
ReloadTime = 1.0

[node name="Sprite" type="Sprite" parent="." index="3"]
position = Vector2( 11.25, 0 )
scale = Vector2( 0.5, 0.8 )
texture = ExtResource( 3 )
region_enabled = true
Expand All @@ -23,4 +24,5 @@ region_rect = Rect2( 734, 365, 65, 116 )
[node name="StaticBody2D" type="StaticBody2D" parent="." index="4"]

[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" index="0"]
position = Vector2( 16, 0 )
shape = SubResource( 1 )

0 comments on commit d8c0eab

Please sign in to comment.