bugfix 06/10/26 + bone ship
This commit is contained in:
parent
7a863b07a6
commit
553303d0fd
27 changed files with 3206 additions and 226 deletions
|
|
@ -513,6 +513,7 @@ namespace RacesOfValheim
|
|||
private Animator fenrirAnim;
|
||||
private readonly FormLocomotion locomotion = new FormLocomotion();
|
||||
|
||||
private float busySince = -1f;
|
||||
private bool isAttacking = false;
|
||||
|
||||
void Start()
|
||||
|
|
@ -525,6 +526,12 @@ namespace RacesOfValheim
|
|||
|
||||
void Update()
|
||||
{
|
||||
if (FormAnimGuard.Stuck(isAttacking, ref busySince))
|
||||
{
|
||||
StopAllCoroutines();
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
if (playerAnim == null || fenrirAnim == null) return;
|
||||
|
||||
// Se stiamo attaccando, l'Update smette di inviare costantemente
|
||||
|
|
@ -590,6 +597,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator ClawRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(fenrirAnim);
|
||||
|
||||
fenrirAnim.SetFloat("forward_speed", 0f);
|
||||
fenrirAnim.SetFloat("sideway_speed", 0f);
|
||||
|
|
@ -624,6 +632,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator JumpAttackRoutine()
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(fenrirAnim);
|
||||
|
||||
fenrirAnim.SetFloat("forward_speed", 0f);
|
||||
fenrirAnim.SetFloat("sideway_speed", 0f);
|
||||
|
|
@ -756,6 +765,7 @@ namespace RacesOfValheim
|
|||
private Animator cultistAnim;
|
||||
private readonly FormLocomotion locomotion = new FormLocomotion();
|
||||
|
||||
private float busySince = -1f;
|
||||
private bool isAttacking = false;
|
||||
private bool isShootingFire = false;
|
||||
private float fireTimer = 0f;
|
||||
|
|
@ -769,6 +779,12 @@ namespace RacesOfValheim
|
|||
}
|
||||
void Update()
|
||||
{
|
||||
if (FormAnimGuard.Stuck(isAttacking, ref busySince))
|
||||
{
|
||||
StopAllCoroutines();
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
if (playerAnim == null || cultistAnim == null) return;
|
||||
|
||||
if (!isAttacking)
|
||||
|
|
@ -889,6 +905,7 @@ namespace RacesOfValheim
|
|||
if (Player.m_localPlayer == null || isShootingFire) return;
|
||||
|
||||
isShootingFire = true;
|
||||
FormAnimGuard.LeaveHowl(cultistAnim);
|
||||
cultistAnim.SetFloat("forward_speed", 0f);
|
||||
cultistAnim.SetFloat("sideway_speed", 0f);
|
||||
cultistAnim.SetBool("attack_fire", true);
|
||||
|
|
@ -1003,6 +1020,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator ClawRoutine()
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(cultistAnim);
|
||||
|
||||
cultistAnim.SetFloat("forward_speed", 0f);
|
||||
cultistAnim.SetFloat("sideway_speed", 0f);
|
||||
|
|
@ -1030,6 +1048,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator DoubleClawRoutine()
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(cultistAnim);
|
||||
|
||||
cultistAnim.SetFloat("forward_speed", 0f);
|
||||
cultistAnim.SetFloat("sideway_speed", 0f);
|
||||
|
|
@ -1130,6 +1149,7 @@ namespace RacesOfValheim
|
|||
private Animator playerAnim;
|
||||
private Animator wolfAnim;
|
||||
private readonly FormLocomotion locomotion = new FormLocomotion();
|
||||
private float busySince = -1f;
|
||||
private bool isAttacking = false;
|
||||
|
||||
void Start()
|
||||
|
|
@ -1142,6 +1162,12 @@ namespace RacesOfValheim
|
|||
|
||||
void Update()
|
||||
{
|
||||
if (FormAnimGuard.Stuck(isAttacking, ref busySince))
|
||||
{
|
||||
StopAllCoroutines();
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
if (playerAnim == null || wolfAnim == null) return;
|
||||
|
||||
if (!isAttacking)
|
||||
|
|
@ -1195,49 +1221,64 @@ namespace RacesOfValheim
|
|||
{
|
||||
isAttacking = true;
|
||||
|
||||
try { wolfAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { wolfAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
try
|
||||
{
|
||||
try { wolfAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { wolfAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
|
||||
FenrirCreatureSound.Howl(wolfAnim, "Wolf", Player.m_localPlayer.transform.position);
|
||||
FenrirCreatureSound.Howl(wolfAnim, "Wolf", Player.m_localPlayer.transform.position);
|
||||
|
||||
// The wolf's howl clip runs 3.13s. Held a little past it so the form does not snap back
|
||||
// into a bite the instant the sound ends.
|
||||
yield return new WaitForSeconds(3.3f);
|
||||
|
||||
isAttacking = false;
|
||||
// The wolf's howl clip runs 3.13s. Held a little past it so the form does not snap back
|
||||
// into a bite the instant the sound ends.
|
||||
yield return new WaitForSeconds(3.3f);
|
||||
}
|
||||
finally
|
||||
{
|
||||
isAttacking = false;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator WolfAttackRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
|
||||
{
|
||||
isAttacking = true;
|
||||
|
||||
try { wolfAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { wolfAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
|
||||
wolfAnim.SetTrigger(triggerName);
|
||||
FenrirAttackSync.Publish(triggerName, "sfx_wolf_attack");
|
||||
|
||||
yield return new WaitForSeconds(dmgDelay);
|
||||
|
||||
if (ZNetScene.instance != null)
|
||||
// finally and not a plain assignment at the end: an exception anywhere below used to
|
||||
// leave isAttacking true for good, and Update does nothing at all while it is.
|
||||
try
|
||||
{
|
||||
GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_wolf_attack");
|
||||
if (attackSfx != null)
|
||||
// Out of the howl first - see FormAnimGuard.
|
||||
FormAnimGuard.LeaveHowl(wolfAnim);
|
||||
|
||||
try { wolfAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { wolfAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
|
||||
wolfAnim.SetTrigger(triggerName);
|
||||
FenrirAttackSync.Publish(triggerName, "sfx_wolf_attack");
|
||||
|
||||
yield return new WaitForSeconds(dmgDelay);
|
||||
|
||||
if (ZNetScene.instance != null)
|
||||
{
|
||||
FenrirCreatureSound.Spawn(attackSfx, Player.m_localPlayer.transform.position);
|
||||
GameObject attackSfx = ZNetScene.instance.GetPrefab("sfx_wolf_attack");
|
||||
if (attackSfx != null)
|
||||
{
|
||||
FenrirCreatureSound.Spawn(attackSfx, Player.m_localPlayer.transform.position);
|
||||
}
|
||||
}
|
||||
|
||||
ExecuteBiteDamage(baseDamage);
|
||||
|
||||
float remainingTimeToIdle = lockDuration - dmgDelay;
|
||||
if (remainingTimeToIdle > 0)
|
||||
{
|
||||
yield return new WaitForSeconds(remainingTimeToIdle);
|
||||
}
|
||||
}
|
||||
|
||||
ExecuteBiteDamage(baseDamage);
|
||||
|
||||
float remainingTimeToIdle = lockDuration - dmgDelay;
|
||||
if (remainingTimeToIdle > 0)
|
||||
finally
|
||||
{
|
||||
yield return new WaitForSeconds(remainingTimeToIdle);
|
||||
try { wolfAnim.ResetTrigger(triggerName); } catch {}
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
wolfAnim.ResetTrigger(triggerName);
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
private void ExecuteBiteDamage(float baseDamage)
|
||||
|
|
@ -1321,6 +1362,7 @@ namespace RacesOfValheim
|
|||
private Animator ulvAnim;
|
||||
private readonly FormLocomotion locomotion = new FormLocomotion();
|
||||
|
||||
private float busySince = -1f;
|
||||
private bool isAttacking = false;
|
||||
|
||||
void Start()
|
||||
|
|
@ -1332,6 +1374,12 @@ namespace RacesOfValheim
|
|||
|
||||
void Update()
|
||||
{
|
||||
if (FormAnimGuard.Stuck(isAttacking, ref busySince))
|
||||
{
|
||||
StopAllCoroutines();
|
||||
isAttacking = false;
|
||||
}
|
||||
|
||||
if (Player.m_localPlayer == null || playerAnim == null || ulvAnim == null) return;
|
||||
|
||||
if (!isAttacking)
|
||||
|
|
@ -1402,6 +1450,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator UlvAttackRoutine(string triggerName, float baseDamage, float lockDuration, float dmgDelay)
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(ulvAnim);
|
||||
|
||||
try { ulvAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { ulvAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
|
|
@ -1510,6 +1559,7 @@ namespace RacesOfValheim
|
|||
private IEnumerator UlvJumpAttackRoutine()
|
||||
{
|
||||
isAttacking = true;
|
||||
FormAnimGuard.LeaveHowl(ulvAnim);
|
||||
|
||||
try { ulvAnim.SetFloat("forward_speed", 0f); } catch {}
|
||||
try { ulvAnim.SetFloat("sideway_speed", 0f); } catch {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue