refactor: Use just ScenePresenceAnimator.CurrentMovementAnimation rather than duplicating it with m_movementAnimation
parent
5bbfb082dd
commit
0ca8491bbe
|
@ -54,11 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The current movement animation
|
/// The current movement animation
|
||||||
/// </value>
|
/// </value>
|
||||||
public string CurrentMovementAnimation
|
public string CurrentMovementAnimation { get; private set; }
|
||||||
{
|
|
||||||
get { return m_movementAnimation; }
|
|
||||||
}
|
|
||||||
protected string m_movementAnimation = "CROUCH";
|
|
||||||
|
|
||||||
private int m_animTickFall;
|
private int m_animTickFall;
|
||||||
public int m_animTickJump; // ScenePresence has to see this to control +Z force
|
public int m_animTickJump; // ScenePresence has to see this to control +Z force
|
||||||
|
@ -80,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
public ScenePresenceAnimator(ScenePresence sp)
|
public ScenePresenceAnimator(ScenePresence sp)
|
||||||
{
|
{
|
||||||
m_scenePresence = sp;
|
m_scenePresence = sp;
|
||||||
|
CurrentMovementAnimation = "CROUCH";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAnimation(UUID animID, UUID objectID)
|
public void AddAnimation(UUID animID, UUID objectID)
|
||||||
|
@ -174,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method determines the proper movement related animation
|
/// This method determines the proper movement related animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DetermineMovementAnimation()
|
private string DetermineMovementAnimation()
|
||||||
{
|
{
|
||||||
const float FALL_DELAY = 800f;
|
const float FALL_DELAY = 800f;
|
||||||
const float PREJUMP_DELAY = 200f;
|
const float PREJUMP_DELAY = 200f;
|
||||||
|
@ -277,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
return "FALLDOWN";
|
return "FALLDOWN";
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_movementAnimation;
|
return CurrentMovementAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Falling/Floating/Landing
|
#endregion Falling/Floating/Landing
|
||||||
|
@ -331,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
|
|
||||||
#region Ground Movement
|
#region Ground Movement
|
||||||
|
|
||||||
if (m_movementAnimation == "FALLDOWN")
|
if (CurrentMovementAnimation == "FALLDOWN")
|
||||||
{
|
{
|
||||||
m_falling = false;
|
m_falling = false;
|
||||||
m_animTickFall = Environment.TickCount;
|
m_animTickFall = Environment.TickCount;
|
||||||
|
@ -344,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
else
|
else
|
||||||
return "LAND";
|
return "LAND";
|
||||||
}
|
}
|
||||||
else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP"))
|
else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP"))
|
||||||
{
|
{
|
||||||
int landElapsed = Environment.TickCount - m_animTickFall;
|
int landElapsed = Environment.TickCount - m_animTickFall;
|
||||||
int limit = 1000;
|
int limit = 1000;
|
||||||
if(m_movementAnimation == "LAND") limit = 350;
|
if (CurrentMovementAnimation == "LAND")
|
||||||
|
limit = 350;
|
||||||
// NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
|
// NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
|
||||||
|
|
||||||
if ((m_animTickFall != 0) && (landElapsed <= limit))
|
if ((m_animTickFall != 0) && (landElapsed <= limit))
|
||||||
{
|
{
|
||||||
return m_movementAnimation;
|
return CurrentMovementAnimation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -392,7 +390,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
|
|
||||||
m_falling = false;
|
m_falling = false;
|
||||||
|
|
||||||
return m_movementAnimation;
|
return CurrentMovementAnimation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -400,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateMovementAnimations()
|
public void UpdateMovementAnimations()
|
||||||
{
|
{
|
||||||
m_movementAnimation = DetermineMovementAnimation();
|
CurrentMovementAnimation = DetermineMovementAnimation();
|
||||||
TrySetMovementAnimation(m_movementAnimation);
|
TrySetMovementAnimation(CurrentMovementAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID[] GetAnimationArray()
|
public UUID[] GetAnimationArray()
|
||||||
|
|
Loading…
Reference in New Issue