internal void Reset() { timePassedComplete = 0; startMainAnimation = false; bAnimationFinished = false; elapsedFrameTime = 0; frameIndex = 0; currentState = animSTATE.buildUp; }
public override void UpdateAnimationForItems(GameTime gameTime) { if (!bAnimationFinished && this.particleAnimationID == 0 && this.particleAnimationName.Equals("")) { bAnimationFinished = true; Console.WriteLine("Ending default PA, soft error"); } timePassedComplete += gameTime.ElapsedGameTime.Milliseconds; if (timePassedComplete < buildUp && !bAnimationFinished) { currentState = animSTATE.buildUp; circleOpacity = (float)timePassedComplete / (float)buildUp; if (circleOpacity < 0) { circleOpacity = 0f; } else if (circleOpacity > 1) { circleOpacity = 1.0f; } } if (!startMainAnimation && currentState != animSTATE.buildOff && timePassedComplete >= buildUp && timePassedComplete < lengthTime - buildOff && !bAnimationFinished) { currentState = animSTATE.main; startMainAnimation = true; elapsedFrameTime = 0; frameIndex = 0; circleOpacity = 1.0f; bSimplePlayOnce = true; } if (timePassedComplete >= lengthTime - buildOff - 400 && !bAnimationFinished) { currentState = animSTATE.buildOff; startMainAnimation = false; circleOpacity = (float)((lengthTime - timePassedComplete)) / (float)buildOff; if (circleOpacity < 0) { circleOpacity = 0f; } else if (circleOpacity > 1) { circleOpacity = 1.0f; } } if (timePassedComplete > lengthTime) { timePassedComplete = 0; if (mcb != null) { mcb.frameIndex = 0; mcb.elapsedFrameTime = 0; circleOpacity = 0f; } if (false)//repeat { bAnimationFinished = false; } frameIndex = 0; currentState = animSTATE.buildUp; } if (circleOpacity < 0) { circleOpacity = 0f; } else if (circleOpacity > 1) { circleOpacity = 1.0f; } if (bAnimationFinished) { } if (startMainAnimation || (currentState == animSTATE.buildOff && !bAnimationFinished)) { base.UpdateAnimationForItems(gameTime); } if (mcb != null) { mcb.frameInterval = 45; mcb.UpdateAnimationForItems(gameTime); } if (refCharForAnim != null && !bAnimationFinished) { switch (currentState) { case animSTATE.buildUp: if (refCharForAnim.animationBattleIndex != (int)BaseCharacter.CharacterBattleAnimations.Idle) { refCharForAnim.ChangeBattleAnimation((int)BaseCharacter.CharacterBattleAnimations.Idle); } break; case animSTATE.main: if (refCharForAnim.animationBattleIndex != (int)supposedAnim) { refCharForAnim.ChangeBattleAnimation((int)supposedAnim); refCharForAnim.currentBattleAnimation().bSimplePlayOnce = true; } else { var refer = refCharForAnim.currentBattleAnimation(); if (!NearlyFinished(5)) { if (refCharForAnim.currentBattleAnimation().frameIndex >= refCharForAnim.climaxHurtFrame) { refCharForAnim.currentBattleAnimation().bPause = true; } } else { currentState = animSTATE.buildOff; } } break; case animSTATE.buildOff: if (refCharForAnim.animationBattleIndex != (int)supposedNextAnim) { if (refCharForAnim.currentBattleAnimation().bAnimationFinished || refCharForAnim.currentBattleAnimation().NearlyFinished(4)) { refCharForAnim.ChangeBattleAnimation((int)supposedNextAnim); } else if (refCharForAnim.currentBattleAnimation().bPause) { refCharForAnim.currentBattleAnimation().bPause = false; } } break; default: break; } } else if (bAnimationFinished && refCharForAnim != null) { if (refCharForAnim.animationBattleIndex != (int)supposedNextAnim) { if (refCharForAnim.currentBattleAnimation().bAnimationFinished) { refCharForAnim.ChangeBattleAnimation((int)supposedNextAnim); } else if (refCharForAnim.currentBattleAnimation().bPause) { refCharForAnim.currentBattleAnimation().bPause = false; } } if (refCharForAnim.currentBattleAnimation().bPause) { refCharForAnim.currentBattleAnimation().bPause = false; } } }