refactor: Use just ScenePresenceAnimator.CurrentMovementAnimation rather than duplicating it with m_movementAnimation

iar_mods
Justin Clark-Casey (justincc) 2011-12-03 00:40:08 +00:00
parent 5bbfb082dd
commit 0ca8491bbe
1 changed files with 12 additions and 14 deletions

View File

@ -54,11 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <value>
/// The current movement animation
/// </value>
public string CurrentMovementAnimation
{
get { return m_movementAnimation; }
}
protected string m_movementAnimation = "CROUCH";
public string CurrentMovementAnimation { get; private set; }
private int m_animTickFall;
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)
{
m_scenePresence = sp;
CurrentMovementAnimation = "CROUCH";
}
public void AddAnimation(UUID animID, UUID objectID)
@ -174,7 +171,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <summary>
/// This method determines the proper movement related animation
/// </summary>
public string DetermineMovementAnimation()
private string DetermineMovementAnimation()
{
const float FALL_DELAY = 800f;
const float PREJUMP_DELAY = 200f;
@ -277,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
return "FALLDOWN";
}
return m_movementAnimation;
return CurrentMovementAnimation;
}
#endregion Falling/Floating/Landing
@ -331,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
#region Ground Movement
if (m_movementAnimation == "FALLDOWN")
if (CurrentMovementAnimation == "FALLDOWN")
{
m_falling = false;
m_animTickFall = Environment.TickCount;
@ -344,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else
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 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
if ((m_animTickFall != 0) && (landElapsed <= limit))
{
return m_movementAnimation;
return CurrentMovementAnimation;
}
else
{
@ -392,7 +390,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_falling = false;
return m_movementAnimation;
return CurrentMovementAnimation;
}
/// <summary>
@ -400,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public void UpdateMovementAnimations()
{
m_movementAnimation = DetermineMovementAnimation();
TrySetMovementAnimation(m_movementAnimation);
CurrentMovementAnimation = DetermineMovementAnimation();
TrySetMovementAnimation(CurrentMovementAnimation);
}
public UUID[] GetAnimationArray()