public void UpdatePosition() { double normalized = this.m_Sync.Normalized; if (normalized >= 1.0) { if (this.m_Timer != null) { return; } this.m_Timer = new Timer(new OnTick(this.Delete_OnTick), 0, 1); this.m_Timer.Start(false); } else { if (normalized >= 0.5) { this.Alpha = (float)(1.0 - (normalized - 0.5) * 2.0); } int num1 = Renderer.m_xWorld; int num2 = Renderer.m_yWorld; int num3 = Renderer.m_zWorld; int x = this.m_Mobile.X; int y = this.m_Mobile.Y; int z = this.m_Mobile.Z; int num4 = x - num1; int num5 = y - num2; int num6 = z - num3; int num7 = (Engine.GameWidth >> 1) + (num4 - num5) * 22; int num8 = (Engine.GameHeight >> 1) + 22 + (num4 + num5) * 22 - num6 * 4; int num9 = num7 + Engine.GameX; int num10 = num8 + Engine.GameY; if (this.m_Mobile.Walking.Count > 0) { WalkAnimation walkAnimation = (WalkAnimation)this.m_Mobile.Walking.Peek(); int xOffset = 0; int yOffset = 0; int fOffset = 0; if (walkAnimation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num9 += xOffset; num10 += yOffset; } } int num11 = num9 - Renderer.m_xScroll; int num12 = num10 - Renderer.m_yScroll; this.X = num11 - (this.Image.xMax - this.Image.xMin + 1) / 2 - this.Image.xMin; this.Y = num12 - 30 - (int)(normalized * 40.0); this.Scissor(new Clipper(Engine.GameX, Engine.GameY, Engine.GameWidth, Engine.GameHeight)); } }
protected virtual void Start() { speed = new Vector2(0, 0); direction = CharacterDirection.DOWN; status = CharacterStatus.IDLE; baseSprite = transform.Find("BaseSprite").gameObject; spriteRenderer = baseSprite.GetComponent <SpriteRenderer>(); effectParent = transform.Find("EffectParent").gameObject; shadowParent = transform.Find("ShadowParent").gameObject; idleAnimation = GetComponent <IdleAnimation>(); walkAnimation = GetComponent <WalkAnimation>(); damageAnimation = GetComponent <DamageAnimation>(); attackAnimation = GetComponent <AttackAnimation>(); GameManager instaince = GameManager.Instance; GameObject shadow = instaince.spriteFactory.instatiateShadow(shadowParent, SpriteFactory.ShadowType.Midiam); shadow.transform.Translate(new Vector3(0, 0, -1)); }
public override void SetAnimation(Animator animator) { WalkAnimation.SetState(animator); }
private void Idle() { Velocity = Vector2.Zero; Animation = IdleAnimation; WalkAnimation.Reset(); }