-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using ABI_RC.Core.Player; | ||
|
||
namespace ml_amt | ||
{ | ||
class AvatarParameter | ||
{ | ||
public enum ParameterType | ||
{ | ||
Upright, | ||
GroundedRaw, | ||
Moving | ||
} | ||
|
||
public enum ParameterSyncType | ||
{ | ||
Synced, | ||
Local | ||
} | ||
|
||
public readonly ParameterType m_type; | ||
public readonly ParameterSyncType m_sync; | ||
public readonly string m_name; | ||
public readonly int m_hash; // For local only | ||
|
||
|
||
public AvatarParameter(ParameterType p_type, string p_name, ParameterSyncType p_sync = ParameterSyncType.Synced, int p_hash = 0) | ||
{ | ||
m_type = p_type; | ||
m_sync = p_sync; | ||
m_name = p_name; | ||
m_hash = p_hash; | ||
} | ||
|
||
public void Update(MotionTweaker p_tweaker) | ||
{ | ||
switch(m_type) | ||
{ | ||
case ParameterType.Upright: | ||
SetFloat(p_tweaker.GetUpright()); | ||
break; | ||
|
||
case ParameterType.GroundedRaw: | ||
SetBoolean(p_tweaker.GetGroundedRaw()); | ||
break; | ||
|
||
case ParameterType.Moving: | ||
SetBoolean(p_tweaker.GetMoving()); | ||
break; | ||
} | ||
} | ||
|
||
void SetFloat(float p_value) | ||
{ | ||
switch(m_sync) | ||
{ | ||
case ParameterSyncType.Local: | ||
PlayerSetup.Instance._animator.SetFloat(m_hash, p_value); | ||
break; | ||
case ParameterSyncType.Synced: | ||
PlayerSetup.Instance.animatorManager.SetAnimatorParameterFloat(m_name, p_value); | ||
break; | ||
} | ||
} | ||
|
||
void SetBoolean(bool p_value) | ||
{ | ||
switch(m_sync) | ||
{ | ||
case ParameterSyncType.Local: | ||
PlayerSetup.Instance._animator.SetBool(m_hash, p_value); | ||
break; | ||
case ParameterSyncType.Synced: | ||
PlayerSetup.Instance.animatorManager.SetAnimatorParameterBool(m_name, p_value); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters