Skip to content

Commit

Permalink
FIX: Bug in anim when unequiped one hand weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
shnok committed Nov 11, 2024
1 parent ae5e347 commit 0f0b2c4
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 65 deletions.
6 changes: 4 additions & 2 deletions l2-unity-todo.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
TODO (priority from top to bottom)

FIX: Bug in anim when no weapon equiped ?
acceptable jump

FIX: Desync in user positions
FIX: if click to move during the FIRST attack animation after log-in or teleport, cant move

handle AOE hits

Expand All @@ -22,6 +22,8 @@ Nature renderer for deco layer

DONE

FIX: Bug in anim when no weapon equiped ?
FIX: if click to move during the FIRST attack animation after log-in or teleport, cant move
title and name colors + pvp/karma in player name color
FIX: cant pvp ?
show karma and pvp/pk kills in stats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,68 +74,10 @@ public virtual void SetBool(string name, bool value)

public virtual void SetBool(int parameterId, bool value)
{
// Debug.LogWarning($"Set bool {parameterId}={value}");
Animator.SetBool(parameterId, value);
}

// // Update animator variable based on Animation Id
// public void SetAnimationProperty(int animId, float value)
// {
// SetAnimationProperty(animId, value, false);
// }

// // Update animator variable based on Animation Id
// public void SetAnimationProperty(int parameterId, float value, bool forceReset)
// {
// //Debug.Log("animId " + animId + "/" + _animator.parameters.Length);
// if (parameterId >= 0 && parameterId < Animator.parameters.Length)
// {
// if (_resetStateOnReceive || forceReset)
// {
// ClearAnimParams();
// }

// Debug.Log("Obsolete: Please move away from straight animation id sharing.");
// AnimatorControllerParameter anim = Animator.parameters[parameterId];

// switch (anim.type)
// {
// case AnimatorControllerParameterType.Float:
// Animator.SetFloat(anim.name, value);
// break;
// case AnimatorControllerParameterType.Int:
// Animator.SetInteger(anim.name, (int)value);
// break;
// case AnimatorControllerParameterType.Bool:
// SetBool(anim.name, value == 1f);
// break;
// case AnimatorControllerParameterType.Trigger:
// Animator.SetTrigger(anim.name);
// break;
// }
// }
// }

// // Return an animator variable based on its ID
// public float GetAnimationProperty(int animId)
// {
// if (animId >= 0 && animId < Animator.parameters.Length)
// {
// AnimatorControllerParameter anim = Animator.parameters[animId];

// switch (anim.type)
// {
// case AnimatorControllerParameterType.Float:
// return Animator.GetFloat(anim.name);
// case AnimatorControllerParameterType.Int:
// return (int)Animator.GetFloat(anim.name);
// case AnimatorControllerParameterType.Bool:
// return Animator.GetBool(anim.name) == true ? 1f : 0;
// }
// }

// return 0f;
// }

public bool GetBool(int parameterId)
{
return Animator.GetBool(parameterId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void WeaponAnimChanged(WeaponAnimType newWeaponAnim)

int newAnimationIndex = GetParameterId(_lastAnimationType, _weaponAnim);

// Debug.Log($"New Weapon animation index: {newAnimationIndex}");
// Debug.Log($"New Weapon animation index: {newAnimationIndex} Last animation type: {_lastAnimationType} Weapon anim: {_weaponAnim}");

SetBool(newAnimationIndex, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void SetBool(HumanoidAnimType animType, bool value, bool share)

if (Animator.GetBool(paramId) != value)
{
//Debug.LogWarning($"Set bool {name}={value}");
// Debug.LogWarning($"Set bool {name}={value}");
SetBool(paramId, value);
}
}
Expand Down
4 changes: 2 additions & 2 deletions l2-unity/Assets/Scripts/Game/Combat/Gear/Gear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,13 @@ public virtual void UnequipWeapon(bool leftSlot)
{
_leftHandWeapon = null;
_leftHandType = WeaponType.hand;
UpdateWeaponAnim(WeaponAnimParser.GetWeaponAnim(_rightHandType));
UpdateWeaponAnim(WeaponAnimParser.GetWeaponAnim(_rightHandType == WeaponType.none ? WeaponType.hand : _rightHandType));
}
else
{
_rightHandWeapon = null;
_rightHandType = WeaponType.hand;
UpdateWeaponAnim(WeaponAnimParser.GetWeaponAnim(_leftHandType));
UpdateWeaponAnim(WeaponAnimParser.GetWeaponAnim(_leftHandType == WeaponType.none ? WeaponType.hand : _leftHandType));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions l2-unity/Assets/Scripts/Game/Combat/Gear/HumanoidGear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ protected override void UpdateWeaponType(WeaponType weaponType)

public override void UpdateWeaponAnim(WeaponAnimType weaponAnim)
{
Debug.LogWarning("UpdateWeaponAnim: " + weaponAnim);
_weaponAnim = weaponAnim;
NotifyAnimator(_weaponAnim);
}
Expand Down

0 comments on commit 0f0b2c4

Please sign in to comment.