diff --git a/Resources/Bullets/icicle_gun_bullets_3D.tres b/Resources/Bullets/icicle_gun_bullets_3D.tres new file mode 100644 index 00000000..cd218f48 --- /dev/null +++ b/Resources/Bullets/icicle_gun_bullets_3D.tres @@ -0,0 +1,24 @@ +[gd_resource type="Resource" script_class="BulletResource" load_steps=3 format=3 uid="uid://csmq6hngkx41e"] + +[ext_resource type="PackedScene" uid="uid://byc67yxbkefyk" path="res://Scenes/Weapons/bullet_3D.tscn" id="1_qojek"] +[ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="3_xep6w"] + +[resource] +script = ExtResource("3_xep6w") +BulletScene = ExtResource("1_qojek") +BulletSpeed = 10.0 +Direction = Vector2(1, 0) +BulletDamage = 0.4 +MaxDamage = 1.0 +Knockback = 100.0 +LifeTime = 10.0 +DestroyOnCollision = true +Owner = 1 +DamageType = 3 +RotateSprite = false +Controllable = false +Freezable = true +Grazeable = false +GrazeValue = 0.2 +Attributes = 256 +TimeModifiers = [] diff --git a/Resources/Items/IcicleGun.tres b/Resources/Items/IcicleGun.tres index 48d3e19c..9379dc4d 100644 --- a/Resources/Items/IcicleGun.tres +++ b/Resources/Items/IcicleGun.tres @@ -1,8 +1,9 @@ -[gd_resource type="Resource" script_class="LootItem" load_steps=4 format=3 uid="uid://cs3ihltcn2166"] +[gd_resource type="Resource" script_class="LootItem" load_steps=5 format=3 uid="uid://cs3ihltcn2166"] [ext_resource type="Resource" uid="uid://b8apu0l5fm4k" path="res://Resources/Weapons/IcicleGun.tres" id="1_itajb"] [ext_resource type="Texture2D" uid="uid://duwiasewxvcb5" path="res://Sprites/Items/Icicle_Gun.png" id="2_eaoas"] [ext_resource type="Script" uid="uid://epnwjptvks3t" path="res://Scripts/Resources/LootItem.cs" id="2_hy2hk"] +[ext_resource type="Resource" uid="uid://bohkmf6g1fi2o" path="res://Resources/Weapons/IcicleGun_3D.tres" id="3_nh721"] [resource] script = ExtResource("2_hy2hk") @@ -14,6 +15,7 @@ Item = 9 Tier = 0 Price = 0 WeaponData = ExtResource("1_itajb") +WeaponData3D = ExtResource("3_nh721") Amount = 1 Max = 1 PickupIfMaxed = false diff --git a/Resources/Weapons/IcicleGun_3D.tres b/Resources/Weapons/IcicleGun_3D.tres new file mode 100644 index 00000000..4b3a2886 --- /dev/null +++ b/Resources/Weapons/IcicleGun_3D.tres @@ -0,0 +1,26 @@ +[gd_resource type="Resource" script_class="WeaponResource" load_steps=5 format=3 uid="uid://bohkmf6g1fi2o"] + +[ext_resource type="Resource" uid="uid://csmq6hngkx41e" path="res://Resources/Bullets/icicle_gun_bullets_3D.tres" id="1_d2kl0"] +[ext_resource type="AudioStream" uid="uid://jsv3yjluv1au" path="res://SFX/Weapons/Reload_01.wav" id="2_sdmjb"] +[ext_resource type="AudioStream" uid="uid://d16xfhll0fujt" path="res://SFX/Ice_Shot.wav" id="3_hj8fq"] +[ext_resource type="Script" uid="uid://b6fmrnipv88bk" path="res://Scripts/Resources/WeaponResource.cs" id="4_ld57e"] + +[resource] +script = ExtResource("4_ld57e") +Name = &"Icicle Gun" +BulletData = ExtResource("1_d2kl0") +Priority = 1 +AmmoPerShot = 1 +RateOfFire = 0.1 +BulletCapacity = 100 +ReloadTime = 0.1 +AutoReload = true +InfiniteAmmo = true +ItemKey = &"ICICLE_GUN" +AmmoKey = &"" +BulletsPerShot = 1 +SpreadAngle = 5.0 +RandomSpread = 2.5 +_rotationOffset = 0.0 +ReloadSound = ExtResource("2_sdmjb") +ShootSound = ExtResource("3_hj8fq") diff --git a/Scenes/Actors/IsoPlayer_FSM.tscn b/Scenes/Actors/IsoPlayer_FSM.tscn index 8a3a1572..2d5803e9 100644 --- a/Scenes/Actors/IsoPlayer_FSM.tscn +++ b/Scenes/Actors/IsoPlayer_FSM.tscn @@ -81,12 +81,12 @@ FallSpeed = 100.0 script = ExtResource("6_habpy") Root = NodePath("..") +[node name="MouseAimProvider" type="Node3D" parent="."] +script = ExtResource("9_2ffwi") + [node name="InputProvider" type="Node" parent="."] script = ExtResource("7_4cdxq") -[node name="MouseAimProvider" type="Node3D" parent="InputProvider"] -script = ExtResource("9_2ffwi") - [node name="Shadow" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -0.29, 0) mesh = SubResource("QuadMesh_fg04g") @@ -128,6 +128,9 @@ bus = &"Effects" [node name="AudioListener3D" type="AudioListener3D" parent="."] current = true +[node name="WeaponOffset" type="Marker3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.267617, 0, -0.24769) + [node name="WeaponModule" type="Node" parent="." node_paths=PackedStringArray("WeaponProvider", "InputProvider", "Storage")] script = ExtResource("15_el8as") WeaponProvider = NodePath("WeaponProvider") @@ -138,8 +141,5 @@ Storage = NodePath("../Storage") script = ExtResource("16_olwak") StorageModule = NodePath("../../Storage") WeaponTemplate = ExtResource("17_olwak") -WeaponRightOffset = NodePath("../Marker3D") -WeaponLeftOffset = NodePath("../Marker3D") - -[node name="Marker3D" type="Marker3D" parent="WeaponModule"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.267617, 0, -0.24769) +WeaponRightOffset = NodePath("../../WeaponOffset") +WeaponLeftOffset = NodePath("../../WeaponOffset") diff --git a/Scenes/Actors/fsm_player.tscn b/Scenes/Actors/fsm_player.tscn index 53a2eca9..9ccc3a62 100644 --- a/Scenes/Actors/fsm_player.tscn +++ b/Scenes/Actors/fsm_player.tscn @@ -444,12 +444,12 @@ script = ExtResource("7_pmkfo") _animatedSprite = NodePath("../Legs") BlinkMaterial = ExtResource("4_5qlss") +[node name="MouseAimProvider" type="Node2D" parent="."] +script = ExtResource("20_3rkrn") + [node name="InputProvider" type="Node" parent="."] script = ExtResource("8_i6wc8") -[node name="MouseAimProvider" type="Node2D" parent="InputProvider"] -script = ExtResource("20_3rkrn") - [node name="CrosshairProvider" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule", "AnimatedSprite")] script = ExtResource("9_s0ir4") StorageModule = NodePath("../Storage") diff --git a/Scenes/Weapons/bullet_3D.tscn b/Scenes/Weapons/bullet_3D.tscn new file mode 100644 index 00000000..a279ae76 --- /dev/null +++ b/Scenes/Weapons/bullet_3D.tscn @@ -0,0 +1,29 @@ +[gd_scene load_steps=4 format=3 uid="uid://byc67yxbkefyk"] + +[ext_resource type="Script" uid="uid://cg6y36s7buapp" path="res://Scripts/Weapons/Bullet3D.cs" id="1_48dvc"] +[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="2_pklkt"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"] +radius = 0.172059 + +[node name="Bullet" type="Area3D" groups=["bullets"]] +collision_layer = 8 +collision_mask = 85 +script = ExtResource("1_48dvc") +Speed = 200.0 +metadata/_edit_group_ = true + +[node name="Sprite" type="Sprite3D" parent="."] +pixel_size = 0.05 +billboard = 1 +texture_filter = 0 +texture = ExtResource("2_pklkt") + +[node name="CollisionShape" type="CollisionShape3D" parent="."] +shape = SubResource("SphereShape3D_pklkt") + +[node name="VisibleOnScreenNotifier" type="VisibleOnScreenNotifier3D" parent="."] + +[connection signal="area_entered" from="." to="." method="_on_area_entered"] +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="screen_exited" from="VisibleOnScreenNotifier" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"] diff --git a/Scripts/Components/Actors/KeyboardInputProvider.cs b/Scripts/Components/Actors/KeyboardInputProvider.cs index 7ad5b787..1fccba0d 100644 --- a/Scripts/Components/Actors/KeyboardInputProvider.cs +++ b/Scripts/Components/Actors/KeyboardInputProvider.cs @@ -47,7 +47,7 @@ public partial class KeyboardInputProvider : InputProvider private void DelayedRegisterGameManager() { - _mouseAImProvider = GetNodeOrNull("MouseAimProvider"); + _mouseAImProvider = this.GetParent().GetNodeOrNull("MouseAimProvider"); if (_mouseAImProvider is null) { @@ -57,10 +57,18 @@ public partial class KeyboardInputProvider : InputProvider if (GameManager.Instance is null) { GD.Print("No GameManager found for keyboard inputprovider"); - return; + + } + else + { + GameManager.Instance.GameStateChange += InstanceOnGameStateChange; } - GameManager.Instance.GameStateChange += InstanceOnGameStateChange; + if (GameController.Instance is not null) + { + GameController.Instance.GameStateChange += InstanceOnGameStateChange; + } + _enabled = true; } diff --git a/Scripts/Components/Actors/MouseAimProvider3D.cs b/Scripts/Components/Actors/MouseAimProvider3D.cs index d0edd5af..abfbba91 100644 --- a/Scripts/Components/Actors/MouseAimProvider3D.cs +++ b/Scripts/Components/Actors/MouseAimProvider3D.cs @@ -13,4 +13,5 @@ public partial class MouseAimProvider3D : Node3D, IMouseAimProvider return mouseWorldPos - screenPosition; } + } \ No newline at end of file diff --git a/Scripts/Components/FSM/3DPlayer/IsoMovementModule.cs b/Scripts/Components/FSM/3DPlayer/IsoMovementModule.cs index 3a2b454a..4aed5611 100644 --- a/Scripts/Components/FSM/3DPlayer/IsoMovementModule.cs +++ b/Scripts/Components/FSM/3DPlayer/IsoMovementModule.cs @@ -53,10 +53,12 @@ public partial class IsoMovementModule : ModuleBase 0.1f) // If the right stick is moved { PlayerStorage.FacingDirection = rightStickInput; + PlayerStorage.AimingDirection = rightStickInput; } else if (movementInput != Vector2.Zero) // Fall back to movement direction { PlayerStorage.FacingDirection = movementInput; + PlayerStorage.AimingDirection = rightStickInput; } // } diff --git a/Scripts/Components/FSM/3DPlayer/PlayerWeaponModule3D.cs b/Scripts/Components/FSM/3DPlayer/PlayerWeaponModule3D.cs index 7df826e7..a1a7d466 100644 --- a/Scripts/Components/FSM/3DPlayer/PlayerWeaponModule3D.cs +++ b/Scripts/Components/FSM/3DPlayer/PlayerWeaponModule3D.cs @@ -52,8 +52,10 @@ public partial class PlayerWeaponModule3D : ModuleBase(); - this.AddChild(weapon); + _parent.AddChild(weapon); + + weapon.GlobalPosition = _parent.GlobalPosition; + //this.CreateSibling(WeaponTemplate); - weapon.WeaponData = startingItem.WeaponData; + weapon.WeaponData = startingItem.WeaponData3D; weapon.Sprite.Texture = startingItem.InventorySprite; diff --git a/Scripts/Controllers/PoolingManager.cs b/Scripts/Controllers/PoolingManager.cs index 1a051824..ebabaac6 100644 --- a/Scripts/Controllers/PoolingManager.cs +++ b/Scripts/Controllers/PoolingManager.cs @@ -124,10 +124,10 @@ public partial class PoolingManager : Node private IBullet InstantiateBullet(BulletResource bulletData) { - var bullet = bulletData.BulletScene.Instantiate(); + var bullet = bulletData.BulletScene.Instantiate(); this.AddChild(bullet); //this.CreateChild(bulletData.BulletScene); - return bullet; + return bullet as IBullet; } } diff --git a/Scripts/Resources/LootItem.cs b/Scripts/Resources/LootItem.cs index 78304998..95424b20 100644 --- a/Scripts/Resources/LootItem.cs +++ b/Scripts/Resources/LootItem.cs @@ -17,6 +17,7 @@ public partial class LootItem : Resource [Export] public int Price { get; set; } [Export] public ItemEffectResource ItemEffect { get; private set; } [Export] public WeaponResource WeaponData { get; set; } + [Export] public WeaponResource WeaponData3D { get; set; } [Export] public int Amount; [Export] public int Max; [Export] public bool PickupIfMaxed; diff --git a/Scripts/Weapons/Bullet3D.cs b/Scripts/Weapons/Bullet3D.cs index 551a571d..c7f182cb 100644 --- a/Scripts/Weapons/Bullet3D.cs +++ b/Scripts/Weapons/Bullet3D.cs @@ -36,17 +36,17 @@ public partial class Bullet3D : Area3D, IBullet [Signal] public delegate void OnDestroyEventHandler(); - private AudioStreamPlayer2D _grazeSound; - private GpuParticles2D _grazeParticles; + private AudioStreamPlayer3D _grazeSound; + private GpuParticles3D _grazeParticles; - private CollisionShape2D _collisionShape2D; + private CollisionShape3D _collisionShape; public override void _Ready() { - _grazeSound = GetNodeOrNull("AudioStreamPlayer2D"); - _grazeParticles = GetNodeOrNull("GrazeParticles"); + _grazeSound = GetNodeOrNull("AudioStreamPlayer"); + _grazeParticles = GetNodeOrNull("GrazeParticles"); - _collisionShape2D = GetNode("CollisionShape2D"); + _collisionShape = GetNode("CollisionShape"); } public void Initialize(BulletInfo bulletInfo, GameManager gameManager) @@ -77,12 +77,12 @@ public partial class Bullet3D : Area3D, IBullet { Enabled = true; Show(); - if (this._collisionShape2D is null) + if (this._collisionShape is null) { - _collisionShape2D = GetNode("CollisionShape2D"); + _collisionShape = GetNode("CollisionShape"); } - _collisionShape2D.SetDeferred(CollisionShape2D.PropertyName.Disabled, false); + _collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false); } /// @@ -96,12 +96,12 @@ public partial class Bullet3D : Area3D, IBullet Hide(); } - if (this._collisionShape2D is null) + if (this._collisionShape is null) { - _collisionShape2D = GetNode("CollisionShape2D"); + _collisionShape = GetNode("CollisionShape2D"); } - _collisionShape2D.SetDeferred(CollisionShape2D.PropertyName.Disabled, true); + _collisionShape.SetDeferred(CollisionShape2D.PropertyName.Disabled, true); } public void Graze() @@ -209,7 +209,9 @@ public partial class Bullet3D : Area3D, IBullet ControlBullet(delta); } - //this.Position += ((float)(Speed * delta) * _direction); + var newPos2D = ((float)(Speed * delta) * _direction); + + this.Position += new Vector3(newPos2D.X, 0, newPos2D.Y); } private void ControlBullet(double delta) @@ -232,7 +234,7 @@ public partial class Bullet3D : Area3D, IBullet Destroy(); } - private void _on_body_entered(Node2D body) + private void _on_body_entered(Node3D body) { if (body.IsInGroup("Solid")) { @@ -247,7 +249,7 @@ public partial class Bullet3D : Area3D, IBullet // } } - private void _on_area_entered(Area2D area) + private void _on_area_entered(Area3D area) { if (area.IsInGroup("Solid")) { diff --git a/Scripts/Weapons/Weapon3D.cs b/Scripts/Weapons/Weapon3D.cs index e1448310..4bce655f 100644 --- a/Scripts/Weapons/Weapon3D.cs +++ b/Scripts/Weapons/Weapon3D.cs @@ -5,7 +5,7 @@ using Godot; namespace Cirno.Scripts.Weapons; -public partial class Weapon3D : Node +public partial class Weapon3D : Node3D { [Export] public WeaponResource WeaponData { get; set; } @@ -103,18 +103,18 @@ public partial class Weapon3D : Node } // Check for battery if it's used - if (UsesBattery) - { - if (GameManager.Instance.Player.Shield.CurrentResource >= WeaponData.AmmoPerShot) - { - GameManager.Instance.Player.Shield.CurrentResource -= WeaponData.AmmoPerShot; - } - else - { - EmitSignalEmpty(); - return; - } - } + // if (UsesBattery) + // { + // if (GameManager.Instance.Player.Shield.CurrentResource >= WeaponData.AmmoPerShot) + // { + // GameManager.Instance.Player.Shield.CurrentResource -= WeaponData.AmmoPerShot; + // } + // else + // { + // EmitSignalEmpty(); + // return; + // } + // } // Out of ammo? if (LoadedAmmo < WeaponData.AmmoPerShot) diff --git a/Sprites/Projectile.png.import b/Sprites/Projectile.png.import index e54dc7cc..fd7caaaf 100644 --- a/Sprites/Projectile.png.import +++ b/Sprites/Projectile.png.import @@ -3,25 +3,26 @@ importer="texture" type="CompressedTexture2D" uid="uid://cybpmpb0d8yva" -path="res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.ctex" +path.s3tc="res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.s3tc.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc"], +"vram_texture": true } [deps] source_file="res://Sprites/Projectile.png" -dest_files=["res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.ctex"] +dest_files=["res://.godot/imported/Projectile.png-a3a119d8fd8345a39899211a3cae4b28.s3tc.ctex"] [params] -compress/mode=0 +compress/mode=2 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/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +32,4 @@ 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 +detect_3d/compress_to=0 diff --git a/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll b/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll deleted file mode 100644 index e733469f..00000000 Binary files a/addons/debug_draw_3d/libs/~libdd3d.windows.editor.x86_64.dll and /dev/null differ