public static WalkAnimation PoolInstance(Mobile m, int x, int y, int z, int dir) { if (WalkAnimation.m_Pool == null) { WalkAnimation.m_Pool = new Queue(); } if (WalkAnimation.m_Pool.Count <= 0) { return(new WalkAnimation(m, x, y, z, dir)); } WalkAnimation walkAnimation = (WalkAnimation)WalkAnimation.m_Pool.Dequeue(); walkAnimation.Initialize(m, x, y, z, dir); return(walkAnimation); }
private void Initialize(Mobile m, int NewX, int NewY, int NewZ, int NewDir) { this.m_Mobile = m; this.m_NewX = NewX; this.m_NewY = NewY; this.m_NewZ = NewZ; this.m_NewDir = NewDir; int num1 = 0; int num2 = 0; int num3 = 0; if (m.Walking.Count == 0) { num1 = m.X; num2 = m.Y; num3 = m.Z; } else { IEnumerator enumerator = m.Walking.GetEnumerator(); WalkAnimation walkAnimation = (WalkAnimation)null; while (enumerator.MoveNext()) { walkAnimation = (WalkAnimation)enumerator.Current; } if (walkAnimation != null) { num1 = walkAnimation.m_NewX; num2 = walkAnimation.m_NewY; num3 = walkAnimation.m_NewZ; } } if (!m.Player) { m.Direction = (byte)NewDir; } this.m_Advance = false; this.m_Sync = (TimeSync)null; if (num1 != NewX || num2 != NewY || num3 != NewZ) { int num4 = NewX - num1; int num5 = NewY - num2; int num6 = NewZ - num3; int num7 = (num4 - num5) * 22; int num8 = (num4 + num5) * 22 - num6 * 4; this.m_X = num7; this.m_Y = num8; int idx = NewDir >> 7 & 1; int speed = m.Speed; if (idx == 1) { speed *= 2; } this.m_Duration = Walking.Speed / (float)speed; this.m_Frames = (float)WalkAnimation.GetFrames(m.IsMounted, idx); } else { this.m_X = 0; this.m_Y = 0; this.m_Duration = 0.1f; this.m_Frames = 0.0f; } }