public void playingAttack() { ANIMATION.Play(attackClip.name); }
void Action(T动作.ET动作Action action) { anime.Play(action.ToString()); }
protected override void InternalEvent(Entry e) { base.InternalEvent(e); // 双击冲刺 ComboClick combo = e.INPUT.Keyboard.GetComboClick((int)PCKeys.A); if (combo != null && combo.IsDoubleClick) { running = true; } else { combo = e.INPUT.Keyboard.GetComboClick((int)PCKeys.D); if (combo != null && combo.IsDoubleClick) { running = true; } } // 按照最后按下的方向键移动 int[] keys = e.INPUT.Keyboard.Current.GetPressedKey(); bool doMove = false; EDirection4 direction = EDirection4.Up; for (int i = keys.Length - 1; i >= 0; i--) { if (keys[i] == (int)PCKeys.A) { flip = EFlip.FlipHorizontally; if (jumpSpeed.Y == 0) { CheckMoveX(-SPEED * (running ? RUNNING : 1)); anime.Play("移动"); } else { jumpSpeed.X -= FLY; } doMove = true; direction = EDirection4.Left; break; } else if (keys[i] == (int)PCKeys.D) { flip = EFlip.None; if (jumpSpeed.Y == 0) { CheckMoveX(SPEED * (running ? RUNNING : 1)); anime.Play("移动"); } else { jumpSpeed.X += FLY; } doMove = true; direction = EDirection4.Right; break; } } // 单击跳跃 if (jumpSpeed.Y == 0 && e.INPUT.Keyboard.IsPressed(PCKeys.W)) { anime.Play("起跳"); jumpSpeed.Y = JUMP; if (doMove) { jumpSpeed.X = SPEED; if (running) { jumpSpeed.X *= RUNNING; } if (direction == EDirection4.Left) { jumpSpeed.X = -jumpSpeed.X; } } else { jumpSpeed.X = 0; } } if (!doMove) { running = false; if (jumpSpeed.Y == 0 && anime.Sequence.Name == "移动") { anime.Play("待机"); } } }