AquaSphereMini.Shrimp.UpdateAnimation C# (CSharp) Method

UpdateAnimation() private method

This function will update the speed of animation, so it will give better match with current moves.
private UpdateAnimation ( ) : void
return void
	private void UpdateAnimation()
	{
		//calculate real anim speed, since we never want to really stop it
		float s = (speed == 0) ? 0.05f : speed;
		if(s < 0.1 && direction != 0)
		{
			s = 0.2f;
		    model.Health = AquaSphere.MODEL.HealthType.SICK;
		}

		if(slast!=s)
		{
				if(s==0.2f) 

				{
					Debug.Log("SWITCH");
					model.Health = AquaSphere.MODEL.HealthType.HEALTHY;
					view.UpdateState();
				}
				else 
				{
					Debug.Log("SWITCH SICK");
					model.Health = AquaSphere.MODEL.HealthType.SICK;
					view.UpdateState();
				}

		}
		slast = s;

		//update each animation's speed
		foreach (AnimationState state in GetComponent<Animation>()) 
		{
            state.speed = s * 0.8f;
        }
	}