public override void reset() { base.reset(); Game game = Game.GAME_INSTANCE; Location l = this.getLocation(); l.addYaw(-game.getGamePad().AnalogRightX); l.addPitch(game.getGamePad().AnalogRightY); if (game.getGamePad().AnalogLeftX != 0) { Location clone = l.clone(); clone.addYaw(90); double p = clone.getPitch(); clone.setPitch(0); clone = clone.getRelativeInFacingDirection(-game.getGamePad().AnalogLeftX / 10.0); clone.addYaw(-90); clone.setPitch(p); l.set(clone); } if (game.getGamePad().AnalogLeftY != 0) { Location clone = l.clone(); clone = clone.getRelativeInFacingDirection(-game.getGamePad().AnalogLeftY / 10.0); l.set(clone); } Location newTarget = l.getRelativeInFacingDirection(1); this.getTarget().set(newTarget); newTarget.Dispose(); }
public static Location lookAt(Location fro, Location to) { Location l = fro.clone(); l.lookAt(to); return(l); }
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(); } } }