public virtual void Dispose() { if (this.entity != null) { this.entity.removeAnimation(this); } foreach (AnimationRule rule in this.getAnimationRules()) { Locateable obj = this.getObject(rule.getObjectID()); if (obj == null) { continue; } if (rule.isRelative()) { obj.getLocation().set(rule.originalLocation); } } }
public virtual void tick() { foreach (AnimationRule rule in this.getAnimationRules()) { lock (rule) { Locateable obj = this.getObject(rule.getObjectID()); if (obj == null) { continue; } if (rule.getAnimationType().Equals(AnimationFramingType.FRAME_BY_FRAME)) { if (this.getFrame() != rule.getFrame()) { continue; } obj.getLocation().set(rule.getTarget()); } else if (rule.getAnimationType().Equals(AnimationFramingType.TWEEN)) { if (frame < rule.getStartFrame()) { continue; } if (frame > (rule.getStartFrame() + rule.getFrame())) { continue; } Location target = rule.getTarget().clone(); target.sub(rule.getStartingPosition()); double amt = 0; int tweenFrame = frame - rule.getStartFrame(); double tf = (double)tweenFrame; double animation_complete_percent = (double)tweenFrame / (double)(rule.getFrame()); double curve = (double)rule.getTweenCurve() / 100.0d; double curve_addition_offset = curve * (1 - animation_complete_percent); amt = tf / (double)rule.getFrame(); target.multiply(amt); Location q = target.clone(); q.multiply(curve_addition_offset); target.add(q); target.add(rule.getStartingPosition()); if (rule.isRelative()) { target.add(rule.originalLocation); } obj.getLocation().set(target); //Target Dispose target.Dispose(); q.Dispose(); } } } frame++; if (frame > this.getTotalFrames()) { if (loop) { frame = 0; } else { this.Dispose(); } } }
public Location set(Locateable l) { return(set(l.getLocation())); }