attack flow - breaking and blocking input, roll improvements

This commit is contained in:
2025-09-10 12:33:13 +02:00
parent 9d6c237088
commit 058920055b
9 changed files with 1219 additions and 491 deletions

View File

@@ -81,8 +81,11 @@ namespace Beyond
private PlayerAttribute brightnessAttribute;
private PlayerAttribute maturityAttribute;
private MagicAttacks m_magicAttacks;
private bMeleeCombatInput m_meleeCombatInput;
public MagicAttacks Magic => m_magicAttacks;
public bMeleeCombatInput MeleeCombatInput => m_meleeCombatInput;
public PlayerAttribute MaturityAttribute
{
get
@@ -186,6 +189,7 @@ namespace Beyond
m_meleeManager = GetComponent<vMeleeManager>();
m_magicAttacks = GetComponent<MagicAttacks>();
m_autoTargetting = GetComponent<AutoTargetting>();
m_meleeCombatInput = GetComponent<bMeleeCombatInput>();
}
@@ -867,10 +871,10 @@ namespace Beyond
public void PlaySingleSound(AudioClip clipToPlay, bool destroyAfterPlaying = true)
{
// Opcjonalne opóŸnienie na starcie poziomu, aby unikn¹æ "spamowania" dŸwiêkami
// Opcjonalne op<EFBFBD>nienie na starcie poziomu, aby unikn<EFBFBD><EFBFBD> "spamowania" d<EFBFBD>wi<EFBFBD>kami
if (Time.timeSinceLevelLoad < 0.5f && clipToPlay != null)
{
// Mo¿esz chcieæ to odkomentowaæ, jeœli dŸwiêki na starcie s¹ problemem
// Mo<EFBFBD>esz chcie<EFBFBD> to odkomentowa<EFBFBD>, je<EFBFBD>li d<EFBFBD>wi<EFBFBD>ki na starcie s<EFBFBD> problemem
// return;
}
@@ -885,28 +889,28 @@ namespace Beyond
return;
}
// Instancjonowanie prefabu dŸwiêkowego
// Upewnij siê, ¿e prefab 'audioSource' ma komponent AudioSource
// Instancjonowanie prefabu d<EFBFBD>wi<EFBFBD>kowego
// Upewnij si<EFBFBD>, <EFBFBD>e prefab 'audioSource' ma komponent AudioSource
GameObject audioObjectInstance = Instantiate(this.audioSource, transform.position, transform.rotation);
AudioSource sourceComponent = audioObjectInstance.GetComponent<AudioSource>();
if (sourceComponent != null)
{
// PlayOneShot jest dobre dla efektów, nie przerywa innych dŸwiêków na tym samym source,
// jeœli s¹ one odtwarzane przez .Play() i nie u¿ywaj¹ tego samego kana³u.
// PlayOneShot jest dobre dla efekt<EFBFBD>w, nie przerywa innych d<EFBFBD>wi<EFBFBD>k<EFBFBD>w na tym samym source,
// je<EFBFBD>li s<EFBFBD> one odtwarzane przez .Play() i nie u<EFBFBD>ywaj<EFBFBD> tego samego kana<EFBFBD>u.
sourceComponent.PlayOneShot(clipToPlay);
if (destroyAfterPlaying)
{
// Niszczymy obiekt GameObject zawieraj¹cy AudioSource po zakoñczeniu odtwarzania klipu.
// Dodajemy ma³y bufor czasowy, aby upewniæ siê, ¿e dŸwiêk zd¹¿y siê odtworzyæ w ca³oœci.
// Niszczymy obiekt GameObject zawieraj<EFBFBD>cy AudioSource po zako<EFBFBD>czeniu odtwarzania klipu.
// Dodajemy ma<EFBFBD>y bufor czasowy, aby upewni<EFBFBD> si<EFBFBD>, <EFBFBD>e d<EFBFBD>wi<EFBFBD>k zd<EFBFBD><EFBFBD>y si<EFBFBD> odtworzy<EFBFBD> w ca<EFBFBD>o<EFBFBD>ci.
Destroy(audioObjectInstance, clipToPlay.length + 0.1f);
}
}
else
{
Debug.LogWarning("The instantiated 'audioSource' prefab (from Player.cs) does not have an AudioSource component. Destroying instance.");
Destroy(audioObjectInstance); // Posprz¹taj, jeœli coœ posz³o nie tak
Destroy(audioObjectInstance); // Posprz<EFBFBD>taj, je<EFBFBD>li co<EFBFBD> posz<EFBFBD>o nie tak
}
}