Item spawning
This commit is contained in:
@@ -125,10 +125,11 @@ namespace GameJamDungeon
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.Animations.Attack output) =>
|
||||
{
|
||||
var attackSpeed = (float)GameRepo.EquippedWeapon.WeaponInfo.AttackSpeed;
|
||||
var weaponInfo = (WeaponInfo)GameRepo.EquippedWeapon.Info;
|
||||
var attackSpeed = (float)weaponInfo.AttackSpeed;
|
||||
AnimationPlayer.SetSpeedScale(attackSpeed);
|
||||
AnimationPlayer.Play("attack");
|
||||
if (GameRepo.EquippedWeapon.WeaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
|
||||
if (weaponInfo.WeaponTags.Contains(WeaponTag.SelfDamage))
|
||||
_currentHP.OnNext(_currentHP.Value - 5);
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.ThrowItem output) =>
|
||||
@@ -160,7 +161,7 @@ namespace GameJamDungeon
|
||||
var roll = rng.Randf();
|
||||
if (roll <= enemy.EnemyStatInfo.Luck)
|
||||
isCriticalHit = true;
|
||||
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor, isCriticalHit);
|
||||
var damage = DamageCalculator.CalculateEnemyDamage(hitBox.Damage, PlayerStatInfo, enemy.EnemyStatInfo, GameRepo.EquippedArmor.ArmorInfo, isCriticalHit);
|
||||
_currentHP.OnNext(_currentHP.Value - damage);
|
||||
GD.Print($"Player hit for {damage} damage.");
|
||||
}
|
||||
@@ -215,7 +216,7 @@ namespace GameJamDungeon
|
||||
AnimationPlayer.AnimationFinished -= OnAnimationFinished;
|
||||
}
|
||||
|
||||
private void OnEquippedWeaponChanged(Weapon info) => Hitbox.Damage = info.WeaponInfo.Damage;
|
||||
private void OnEquippedWeaponChanged(Weapon info) => Hitbox.Damage = ((WeaponInfo)info.Info).Damage;
|
||||
|
||||
private void OnHPChanged(double newHP)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,29 @@
|
||||
[gd_scene load_steps=20 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
[gd_scene load_steps=21 format=3 uid="uid://cfecvvav8kkp6"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/player/Player.cs" id="1_xcol5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bokx3h8kfdo5i" path="res://src/player/slash_0000_Classic_30.png" id="2_la11l"]
|
||||
[ext_resource type="Script" path="res://src/hitbox/Hitbox.cs" id="2_lb3qc"]
|
||||
[ext_resource type="Resource" uid="uid://cofd1ylluj24" path="res://src/player/PlayerStats.tres" id="2_nuh2a"]
|
||||
[ext_resource type="Script" path="res://src/player/PlayerStatInfo.cs" id="2_n88di"]
|
||||
[ext_resource type="Texture2D" uid="uid://byosr5gk51237" path="res://src/player/slash_0001_Classic_29.png" id="3_ux3f1"]
|
||||
[ext_resource type="Texture2D" uid="uid://nh071o6ii03j" path="res://src/player/slash_0002_Classic_28.png" id="4_gqnq0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bodfblud4kea3" path="res://src/player/slash_0003_Classic_27.png" id="5_eebal"]
|
||||
[ext_resource type="Texture2D" uid="uid://de55prolicl0u" path="res://src/player/slash_0004_Classic_26.png" id="6_ngag5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bp0msic3uk3kc" path="res://src/player/slash_0005_Layer-1.png" id="7_tp5uu"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_up0v1"]
|
||||
script = ExtResource("2_n88di")
|
||||
MaximumHP = 100.0
|
||||
MaximumVT = 90
|
||||
BaseAttack = 10
|
||||
BaseDefense = 5
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_wedu3"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_dw45s"]
|
||||
height = 1.7
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_dmans"]
|
||||
height = 1.7
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_hs4wf"]
|
||||
size = Vector3(1.94531, 2.43945, 1.08447)
|
||||
@@ -124,9 +133,8 @@ collision_layer = 38
|
||||
collision_mask = 7
|
||||
script = ExtResource("1_xcol5")
|
||||
RotationSpeed = 0.025
|
||||
MoveSpeed = 3.0
|
||||
Acceleration = 0.01
|
||||
PlayerStatInfo = ExtResource("2_nuh2a")
|
||||
MoveSpeed = 2.0
|
||||
PlayerStatInfo = SubResource("Resource_up0v1")
|
||||
|
||||
[node name="Hitbox" type="Area3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
Reference in New Issue
Block a user