From 0ca8491bbeab74e4cb50521d4857104c7e0a59b9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 3 Dec 2011 00:40:08 +0000
Subject: refactor: Use just ScenePresenceAnimator.CurrentMovementAnimation
rather than duplicating it with m_movementAnimation
---
.../Scenes/Animation/ScenePresenceAnimator.cs | 26 ++++++++++------------
1 file changed, 12 insertions(+), 14 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index cac936c..2a6b8ea 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -54,11 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
///
/// The current movement animation
///
- 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
///
/// This method determines the proper movement related animation
///
- 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;
}
///
@@ -400,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
///
public void UpdateMovementAnimations()
{
- m_movementAnimation = DetermineMovementAnimation();
- TrySetMovementAnimation(m_movementAnimation);
+ CurrentMovementAnimation = DetermineMovementAnimation();
+ TrySetMovementAnimation(CurrentMovementAnimation);
}
public UUID[] GetAnimationArray()
--
cgit v1.1