void _handleAlphaStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed) { this.dispose(); } }
public void notifyStatusListeners(AnimationStatus status) { var localListeners = new List <AnimationStatusListener>(this._statusListeners); foreach (AnimationStatusListener listener in localListeners) { try { if (this._statusListeners.Contains(listener)) { listener(status); } } catch (Exception exception) { UIWidgetsError.reportError(new UIWidgetsErrorDetails( exception: exception, library: "animation library", context: "while notifying status listeners for " + this.GetType(), informationCollector: information => { information.AppendLine("The " + this.GetType() + " notifying status listeners was:"); information.Append(" " + this); } )); } } }
void _handleStatusChanged(AnimationStatus status) { if (status == AnimationStatus.dismissed) { this._removeEntry(); } }
void _onEntranceStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed) { this.setState(() => { this._requestAnimationToNextIndex(); }); } }
// Update is called once per frame void Update() { if (player_control.speed.x<0 && animation_status!=AnimationStatus.RunLeft) { sprite_parent.localScale = new Vector3(1,1,1); player_sprite.Play("Run"); animation_status = AnimationStatus.RunLeft; } else if (player_control.speed.x>0 && animation_status!=AnimationStatus.RunRight) { sprite_parent.localScale = new Vector3(-1,1,1); player_sprite.Play("Run"); animation_status = AnimationStatus.RunRight; } else { player_sprite.Play ("Stand"); if (sprite_parent.localScale.x<0) animation_status = AnimationStatus.StandRight; else animation_status = AnimationStatus.StandLeft; } if (player_control.speed.y!=0 && animation_status != AnimationStatus.Jump) { animation_status = AnimationStatus.Jump; player_sprite.Play ("Jump"); } }
protected void PlayAnimation(AnimationStatus status, List <SpriteAnimationEntity> animation) { if (animationStatus == AnimationStatus.ATTACK) { if (animationRoutine != null) { StopCoroutine(animationRoutine); animationRoutine = null; } return; } if (status == animationStatus) { return; } animationStatus = status; if (animationRoutine != null) { StopCoroutine(animationRoutine); animationRoutine = null; } if (animation.Count == 0) { return; } animationRoutine = StartCoroutine(PlayAnimationRoutine(animation)); }
void _handleAlphaStatusChanged(AnimationStatus status) { if (status == AnimationStatus.dismissed && !_active) { dispose(); } }
void _maybeNotifyStatusListeners(AnimationStatus _) { if (status != _lastStatus) { _lastStatus = status; notifyStatusListeners(status); } }
public AnimationFightEvent( AnimationStatus status, Character attacker, Character defender) : base(status, attacker.gameObject) { Attacker = attacker; Defender = defender; }
public virtual void Start() { animationStatus = AnimationStatus.Executing; if (!string.IsNullOrEmpty(soundName) && sound == null) { sound = AudioManager.PlaySound(soundName); } }
public void PlayAnim() { if (AnimStatus == AnimationStatus.AnimationBegin || AnimStatus == AnimationStatus.AnimationEnd) { AnimStatus = AnimationStatus.PlayingAnimation; StartTime = Time.time; } }
protected override Sprite SpriteForStatus(AnimationStatus Status) { HelmAnimation = HelmAnimations.Animation(Status); HelmSprite.Sprite = HelmAnimation; WeaponAnimation = WeaponAnimations.Animation(Status); WeaponSprite.Sprite = WeaponAnimation; return(Animations.Animation(Status)); }
void _maybeNotifyStatusListeners(AnimationStatus _) { if (this.status != this._lastStatus) { this._lastStatus = this.status; this.notifyStatusListeners(this.status); } }
public override void initState() { base.initState(); widget.animation.addStatusListener((AnimationStatus animationStatus) => { _lastAnimationStatus = _currentAnimationStatus; _currentAnimationStatus = animationStatus; }); }
public LevelAnimation() { _cFrame = 0; TimeInto = 0; Frames = new List <Texture2D>(); Status = AnimationStatus.Finished; }
void _handleDismissStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed && !this._dragUnderway) { this._startResizeAnimation(); } this.updateKeepAlive(); }
private void AnimationStatusListener(AnimationStatus status) { if (status == AnimationStatus.dismissed) { var state = HomePage.of(context); state.IsShowDiscovery = false; state.setState(); } }
void _resetOrientationAnimation(AnimationStatus status) { if (status == AnimationStatus.completed) { D.assert(_orientationAnimation.value == Mathf.PI); _orientationOffset += Mathf.PI; _orientationController.setValue(0.0f); // TODO(ianh): This triggers a pointless rebuild. } }
public AnimationSequence(string name, int frameFrom, int frameTo) { this.name = name; this.frameFrom = frameFrom; this.frameTo = frameTo; currentFrame = frameFrom; status = AnimationStatus.RUNNING; mode = AnimationMode.STOP_AT_END; }
void _handleShowAllActionsStatusChanged(AnimationStatus status) { if (status == AnimationStatus.completed || status == AnimationStatus.dismissed) { this.setState(() => { }); } this.updateKeepAlive(); }
void _handleStatusChange(AnimationStatus status) { bool value = this.widget.controller.status == this.widget.status; if (this._active != value) { this.setState(() => { this._active = value; }); } }
TickerFuture _animateToInternal(float target, TimeSpan?duration = null, Curve curve = null) { curve = curve ?? Curves.linear; TimeSpan?simulationDuration = duration; if (simulationDuration == null) { D.assert(() => { if ((this.duration == null && _direction == _AnimationDirection.reverse && reverseDuration == null) || (this.duration == null && _direction == _AnimationDirection.forward)) { throw new UIWidgetsError( "AnimationController.animateTo() called with no explicit Duration and no default duration or reverseDuration.\n" + "Either the \"duration\" argument to the animateTo() method should be provided, or the " + "\"duration\" and/or \"reverseDuration\" property should be set, either in the constructor or later, before " + "calling the animateTo() function." ); } return(true); }); float range = upperBound - lowerBound; float remainingFraction = range.isFinite() ? (target - _value).abs() / range : 1.0f; TimeSpan directionDuration = (_direction == _AnimationDirection.reverse && reverseDuration != null) ? reverseDuration.Value : this.duration.Value; simulationDuration = TimeSpan.FromTicks((long)(directionDuration.Ticks * remainingFraction)); } else if (target == value) { simulationDuration = TimeSpan.Zero; } stop(); if (simulationDuration == TimeSpan.Zero) { if (_value != target) { _value = target.clamp(lowerBound, upperBound); notifyListeners(); } _status = (_direction == _AnimationDirection.forward) ? AnimationStatus.completed : AnimationStatus.dismissed; _checkStatusChanged(); return(TickerFuture.complete()); } D.assert(simulationDuration > TimeSpan.Zero); D.assert(!isAnimating); return(_startSimulation( new _InterpolationSimulation(_value, target, simulationDuration.Value, curve))); }
void _checkStatusChanged() { AnimationStatus newStatus = status; if (_lastReportedStatus != newStatus) { _lastReportedStatus = newStatus; notifyStatusListeners(newStatus); } }
void _checkStatusChanged() { AnimationStatus newStatus = this.status; if (this._lastReportedStatus != newStatus) { this._lastReportedStatus = newStatus; this.notifyStatusListeners(newStatus); } }
public void CastNextAnimation() { animationStatus = AnimationStatus.none; lastRunAnimation = ""; if (actionQueue.Count > 0) { lastRunAnimation = actionQueue.Peek().Method.Name; actionQueue.Dequeue()(); } }
void _handleStatusChange(AnimationStatus status) { bool value = widget.controller.status == widget.status; if (_active != value) { setState(() => { _active = value; }); } }
public _TappableWhileStatusIs( AnimationStatus status, Key key = null, AnimationController controller = null, Widget child = null ) : base(key: key) { this.controller = controller; this.status = status; this.child = child; }
void _statusChangeHandler(AnimationStatus status) { D.assert(_currentTrain != null); if (status != _lastStatus) { notifyListeners(); _lastStatus = status; } D.assert(_lastStatus != null); }
public void _routeAnimationStatusListener(AnimationStatus status) { if (status != AnimationStatus.dismissed) { return; } setState(() => { _childHidden = false; }); _route.animation.removeStatusListener(_routeAnimationStatusListener); _route = null; }
public void TopMove(Control control, int endTop, int lastTime, AnimationType animationType) { Dispose(); _timer = new Timer(); _timer.Interval = 15; // CAUSION, this value may not work for you int _frames = lastTime % _timer.Interval > 0 ? lastTime / _timer.Interval + 1 : lastTime / _timer.Interval; AnimationStatus animationStatue = new AnimationStatus("Top", control.Top, endTop, _frames, animationType); _timer.Tick += delegate { Animate(control, _timer, animationStatue); }; _timer.Enabled = true; _timer.Start(); }
/// <summary> /// Used to group animations by direction /// </summary> /// <param name="AnimationFactory">Creates an animation for a given direction. Return <see langword="null"/> for no animation</param> public AnimationGroup(Func <AnimationStatus, AnimatedSprite> AnimationFactory) { for (int i = 0; i < AnimationStatuses.Length; i++) { AnimationStatus Status = AnimationStatuses[i]; AnimatedSprite Sprite = AnimationFactory(Status); if (Sprite != null) { Animations[Status] = Sprite; } } }
void _storyboard_Completed(object sender, EventArgs e) { _storyboard.Stop(); Status = AnimationStatus.Stopped; if (_playCompleted != null) { _playCompleted(this, new CompletedEventArgs() { UserState = m_userState }); } }
void Start () { currentStatus = AnimationStatus.Idle; // By default loop all animations // animationGameObject.animation.wrapMode = WrapMode.Loop; animationGameObject.animation["run"].layer = -1; animationGameObject.animation["run"].wrapMode = WrapMode.Loop; animationGameObject.animation["walk"].layer = -1; animationGameObject.animation["walk"].wrapMode = WrapMode.Loop; animationGameObject.animation["idle"].layer = -2; animationGameObject.animation.SyncLayer(-1); animationGameObject.animation["fly"].layer = 1; animationGameObject.animation["fly"].wrapMode = WrapMode.ClampForever; // animationGameObject.animation["elevate"].layer = 1; // animationGameObject.animation["lower"].layer = 1; animationGameObject.animation["idle"].wrapMode = WrapMode.Loop; // The jump animation is clamped and overrides all others animationGameObject.animation["jump"].layer = 10; animationGameObject.animation["jump"].wrapMode = WrapMode.ClampForever; animationGameObject.animation["fall"].layer = 10; animationGameObject.animation["fall"].wrapMode = WrapMode.Loop; animationGameObject.animation["land"].layer = 10; animationGameObject.animation["land"].wrapMode = WrapMode.Once; animationGameObject.animation["fallHit"].layer = 10; animationGameObject.animation["fallHit"].wrapMode = WrapMode.Once; // We are in full control here - don't let any other animations play when we start animationGameObject.animation.Stop(); animationGameObject.animation.Play("idle"); characterController = GetComponent<ThirdPersonController>(); flyingController = GetComponent<ThirdPersonFlyingController>(); }
public void Update(GameTime time) { var now = time.ElapsedGameTime.Milliseconds; if (this.Status == AnimationStatus.WAITING_TO_START){ StartTime = now; this.Status = AnimationStatus.IN_PROGRESS; } var fps = 30.0f * Speed; var fpms = fps / 1000; var runTime = now - StartTime; uint frame = (uint)(runTime * fpms); var fraction = (runTime * fpms) - frame; int numDone = 0; /** Speed is 30fps by default **/ foreach (var motion in Animation.Motions) { var bone = Avatar.Skeleton.GetBone(motion.BoneName); var motionFrame = frame; if (frame >= motion.FrameCount) { numDone++; motionFrame = motion.FrameCount - 1; } if (motion.HasTranslation) { bone.Translation = Animation.Translations[motion.FirstTranslationIndex + motionFrame]; } if (motion.HasRotation) { bone.Rotation = Animation.Rotations[motion.FirstRotationIndex + motionFrame]; } } if (numDone == Animation.Motions.Length) { /** Completed! **/ this.Status = AnimationStatus.COMPLETED; } else { Avatar.ReloadSkeleton(); } }
public void SetStatus(AnimationStatus status) { Status = status; }
private void ChangeLayersWeight(AnimationStatus status) { switch (status) { case AnimationStatus.Idle: StartCoroutine(ChangeLayerWeightCoroutine(0, userAnimator.GetLayerWeight(0), 1)); // StartCoroutine(ChangeLayerWeightCoroutine(1, userAnimator.GetLayerWeight(1), 0)); StartCoroutine(ChangeLayerWeightCoroutine(2, userAnimator.GetLayerWeight(2), 0)); StartCoroutine(ChangeLayerWeightCoroutine(3, userAnimator.GetLayerWeight(3), 0)); break; case AnimationStatus.HitStay: StartCoroutine(ChangeLayerWeightCoroutine(0, userAnimator.GetLayerWeight(0), 0)); // StartCoroutine(ChangeLayerWeightCoroutine(1, userAnimator.GetLayerWeight(1), 0)); StartCoroutine(ChangeLayerWeightCoroutine(2, userAnimator.GetLayerWeight(2), 0)); StartCoroutine(ChangeLayerWeightCoroutine(3, userAnimator.GetLayerWeight(3), 1)); break; case AnimationStatus.HitRunning: StartCoroutine(ChangeLayerWeightCoroutine(0, userAnimator.GetLayerWeight(0), 0)); // StartCoroutine(ChangeLayerWeightCoroutine(1, userAnimator.GetLayerWeight(1), 1)); StartCoroutine(ChangeLayerWeightCoroutine(2, userAnimator.GetLayerWeight(2), 1)); StartCoroutine(ChangeLayerWeightCoroutine(3, userAnimator.GetLayerWeight(3), 0)); break; } }
private void GroundedAnimations() { //blend off any residual animations animationGameObject.animation.Blend("fall", 0.0f, 0.1f); animationGameObject.animation.Blend("jump", 0.0f, 0.1f); animationGameObject.animation.Blend("fly", 0.0f, 0.1f); animationGameObject.animation.Blend("elevate", 0.0f, 0.1f); animationGameObject.animation.Blend("lower", 0.0f, 0.1f); //Fade in Run if (characterController.GetSpeed() >= (characterController.GetRunSpeed() - 1)) { animationGameObject.animation.CrossFade("run"); currentStatus = AnimationStatus.Run; //fade out walk animationGameObject.animation.Blend("walk", 0.0f, 0.3f); } // Fade in walk else if (characterController.GetSpeed() > 0.1f) { if (characterController.AreMovingKeysDown()) { animationGameObject.animation.CrossFade("walk"); currentStatus = AnimationStatus.Walk; } else { animationGameObject.animation.Blend("walk", 0.0f, 0.1f); } // We fade out jumpland realy quick otherwise we get sliding feet animationGameObject.animation.Blend("run", 0.0f, 0.3f); } // Fade out walk and run so just idle remains else { animationGameObject.animation.Blend("walk", 0.0f, 0.3f); currentStatus = AnimationStatus.Idle; // animationGameObject.animation.Blend("run", 0.0f, 0.3f); } animationGameObject.animation["run"].normalizedSpeed = runSpeedScale; animationGameObject.animation["walk"].normalizedSpeed = walkSpeedScale; //is Character Jumping if (characterController.IsJumping()) { if (!characterController.HasJumpReachedApex() && characterController.IsJumping()) { animationGameObject.animation.CrossFade("jump", 0.2f); animationGameObject.animation.Blend("fall", 0.0f, 0.3f); } else { animationGameObject.animation.Blend("jump", 0.0f, 0.3f); animationGameObject.animation.CrossFade("fall", 0.2f); } currentStatus = AnimationStatus.Jump; animationGameObject.animation.Blend("walk", 0.0f, 0.1f); animationGameObject.animation.Blend("run", 0.0f, 0.1f); } }
public void Update(long time, GameObj obj) { currentFrame++; if (currentFrame > frameTo) { switch (mode) { case AnimationMode.LOOP: currentFrame = frameFrom; break; case AnimationMode.STOP_AT_START: status = AnimationStatus.STOP; obj.animationEnded(this); currentFrame = frameTo; break; case AnimationMode.STOP_AT_END: status = AnimationStatus.STOP; obj.animationEnded(this); currentFrame--; break; } } }
public void Update(GameTime gameTime) { if (Current != Next) { if (_currentPosition.Y != 0 && _status == AnimationStatus.ToNeutral) { _currentPosition.Y = MathHelper.Lerp(_gearPositions[Current].Y, 0, _amount); if (_amount >= 1) { _currentPosition.Y = 0; _amount = 0; _lastPos = _currentPosition; } } else if (_currentPosition.X != _gearPositions[Next].X) { _currentPosition.X = MathHelper.Lerp(_lastPos.X, _gearPositions[Next].X, _amount); if (_amount >= 1) { _currentPosition.X = _gearPositions[Next].X; _amount = 0; _lastPos = _currentPosition; } } else if (_currentPosition.Y != _gearPositions[Next].Y) { _status = AnimationStatus.ToY; _currentPosition.Y = MathHelper.Lerp(_lastPos.Y, _gearPositions[Next].Y, _amount); if (_amount >= 1) { _currentPosition.Y = _gearPositions[Next].Y; _amount = 0; } } else if (_currentPosition.X == _gearPositions[Next].X && _currentPosition.Y == _gearPositions[Next].Y) { _status = AnimationStatus.ToNeutral; Current = Next; _waitAtEndOfAnimationTime = 0.5f; } _amount += (float)gameTime.ElapsedGameTime.TotalSeconds * (_gearPositions[Current].X != _gearPositions[Next].X ? 7.5f : 5.5f); } if (_waitAtEndOfAnimationTime >= 0) _waitAtEndOfAnimationTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; }