/// <summary> /// Stops currently playing <see cref="Animation"/> /// </summary> public new void ResetCurrentAnimation() { IsAnimated = false; if (ObjectAnimation != null) { ObjectAnimation.CurrentFrame = 0; this.CurrentTexture = new Texture(ObjectAnimation.GetFrame(ObjectAnimation.CurrentFrame), TextureLayout.Stretch); } }
private void Update() { if (objectAnimation != null && objectAnimation.animate) { AnimationFrame frame = objectAnimation.GetFrame(Time.deltaTime); if (frame != null) { transform.position = frame.position; transform.rotation = frame.rotation; } } }
internal void InternalUpdate() { //UpdateCollider(); if (IsAnimated) { ObjectAnimation.CountedTicks++; if (ObjectAnimation.CountedTicks == ObjectAnimation.FrameTickTrigger) { ObjectAnimation.CountedTicks = 0; if (ObjectAnimation.CurrentFrame == ObjectAnimation.AnimationFramesCount - 1) { ObjectAnimation.CurrentFrame = 0; } else { ObjectAnimation.CurrentFrame++; } } this.CurrentTexture = new Texture(ObjectAnimation.GetFrame(ObjectAnimation.CurrentFrame), TextureLayout.Stretch); } }