//动画播放完毕 public void PlaneAnimationEnd() { switch (m_AnimationPlayState) { case AnimationPlayState.One: { //Debug.Log("一个角色 播放完毕"); GameSelectMap(); break; } case AnimationPlayState.Two: { //Debug.Log("两个角色中的一个播放完毕"); m_AnimationPlayState = AnimationPlayState.OneEnd; break; } case AnimationPlayState.OneEnd: { //Debug.Log("两个角色的动画都播放完毕"); GameSelectMap(); break; } } }
//初始化动画的播放状态的模式 private void IniAnimationPlayState() { //Debug.Log("初始化动画的播放状态的模式"); if (((RaceSceneControl)GameRoot.CurrentSceneControl).iParkourControllerScriptCS.playerXiongDa.IsEnterStart && ((RaceSceneControl)GameRoot.CurrentSceneControl).iParkourControllerScriptCS.playerXiong2.IsEnterStart) { m_AnimationPlayState = AnimationPlayState.Two; //Debug.Log("初始化动画的播放状态的模式:::两个玩家"); } else if (((RaceSceneControl)GameRoot.CurrentSceneControl).iParkourControllerScriptCS.playerXiongDa.IsEnterStart || ((RaceSceneControl)GameRoot.CurrentSceneControl).iParkourControllerScriptCS.playerXiong2.IsEnterStart) { m_AnimationPlayState = AnimationPlayState.One; //Debug.Log("初始化动画的播放状态的模式:::一个玩家"); } }
public virtual void Initialize(Texture2D sourcetexture, Rectangle firstframe, SpriteDirection direction, int framecount, int FPS) { #if DEBUG // If we're not in debug let the initialize try anyways. worst case scenario it throws an exception. if (direction == SpriteDirection.right) { valid = (sourcetexture != null && (firstframe.X + (firstframe.Width * framecount) <= sourcetexture.Width) && firstframe.Height <= sourcetexture.Height && FPS >= 1); } else { valid = (sourcetexture != null && (firstframe.Y + (firstframe.Height * framecount) <= sourcetexture.Height) && firstframe.Width <= sourcetexture.Height && FPS >= 1); } if (!valid) { throw new Exception("Woah tiger, something isn't right here. Sort your shit out."); } #endif this.framecount = framecount; this.sourcetexture = sourcetexture; this.state = AnimationPlayState.play; this.framespace = (1.0 / (double)FPS); this.currentframe = 0; this.frametime = new TimeSpan(0, 0, 0, 0, 0); destrect = new Rectangle[framecount]; for (int i = 0; i < framecount; ++i) { destrect[i] = new Rectangle(); destrect[i].Width = firstframe.Width; destrect[i].Height = firstframe.Height; if (direction == SpriteDirection.right) { destrect[i].X = (firstframe.X + (i * firstframe.Width)); destrect[i].Y = firstframe.Y; } else { destrect[i].X = firstframe.X; destrect[i].Y = (firstframe.Y + (framecount * firstframe.Height)); } } }
private void EnterStart() { if (UniGameOptionsDefine.chargeMode == UniInsertCoinsOptionsFile.GameChargeMode.Mode_Free || UniGameOptionsDefine.chargeMode == UniInsertCoinsOptionsFile.GameChargeMode.Mode_InsertCoins) { if (GameRoot.gameProcessControl.currentProcess.processType == ModalProcessType.Process_SelectPlayer) { if (!((RaceSceneControl)GameRoot.CurrentSceneControl).XiongDaIsEnterStart) { // Debug.Log("选择用户:::开始游戏1"); if (ConsoleCenter.IsCanStartGame(IParkourPlayer_Xiong.PlayerIndex.Index_P1) && InputDevice.ButtonEnter((int)IParkourPlayer_Xiong.PlayerIndex.Index_P1)) { // Debug.Log("选择用户:::已开始游戏1"); ConsoleCenter.PlayerStartGamePayCoins(IParkourPlayer_Xiong.PlayerIndex.Index_P1); ((RaceSceneControl)GameRoot.CurrentSceneControl).XiongDaIsEnterStart = true; InputDevice.SetEggNums(0, UniGameOptionsDefine.CoinsEggNums_1P); m_AnimationPlayState = AnimationPlayState.Two; ControlUI(); StandbyProcess.UpdateCoinsUI(IParkourPlayer_Xiong.PlayerIndex.Index_P1); } } if (!((RaceSceneControl)GameRoot.CurrentSceneControl).Xiong2IsEnterStart) { //Debug.Log("选择用户:::开始游戏2"); if (ConsoleCenter.IsCanStartGame(IParkourPlayer_Xiong.PlayerIndex.Index_P2) && InputDevice.ButtonEnter((int)IParkourPlayer_Xiong.PlayerIndex.Index_P2)) { //Debug.Log("选择用户:::已开始游戏2"); ConsoleCenter.PlayerStartGamePayCoins(IParkourPlayer_Xiong.PlayerIndex.Index_P2); ((RaceSceneControl)GameRoot.CurrentSceneControl).Xiong2IsEnterStart = true; InputDevice.SetEggNums(1, UniGameOptionsDefine.CoinsEggNums_1P); m_AnimationPlayState = AnimationPlayState.Two; ControlUI(); StandbyProcess.UpdateCoinsUI(IParkourPlayer_Xiong.PlayerIndex.Index_P2); } } } } }
private void btnStopAnim_Click(object sender, EventArgs e) { animationState = AnimationPlayState.Stop; }
public void play() { state = AnimationPlayState.play; }
public void pause() { state = AnimationPlayState.pause; }
public void stop() { state = AnimationPlayState.stop; frametime = new TimeSpan(0, 0, 0, 0, 0); currentframe = 0; }
public virtual void Initialize(Texture2D sourcetexture, Rectangle firstframe, SpriteDirection direction, int framecount, int FPS) { #if DEBUG // If we're not in debug let the initialize try anyways. worst case scenario it throws an exception. if (direction == SpriteDirection.right) valid = (sourcetexture != null && (firstframe.X + (firstframe.Width * framecount) <= sourcetexture.Width) && firstframe.Height <= sourcetexture.Height && FPS >= 1); else valid = (sourcetexture != null && (firstframe.Y + (firstframe.Height * framecount) <= sourcetexture.Height) && firstframe.Width <= sourcetexture.Height && FPS >= 1); if (!valid) throw new Exception("Woah tiger, something isn't right here. Sort your shit out."); #endif this.framecount = framecount; this.sourcetexture = sourcetexture; this.state = AnimationPlayState.play; this.framespace = (1.0 / (double)FPS); this.currentframe = 0; this.frametime = new TimeSpan(0, 0, 0, 0, 0); destrect = new Rectangle[framecount]; for (int i = 0; i < framecount; ++i) { destrect[i] = new Rectangle(); destrect[i].Width = firstframe.Width; destrect[i].Height = firstframe.Height; if (direction == SpriteDirection.right) { destrect[i].X = (firstframe.X + (i * firstframe.Width)); destrect[i].Y = firstframe.Y; } else { destrect[i].X = firstframe.X; destrect[i].Y = (firstframe.Y + (framecount * firstframe.Height)); } } }