public void OnMove(float ange, MoveType moveType) { switch (moveType) { case MoveType.NONE: return; case MoveType.STOP: ThisActionUnit.ChangeMoveAction(CharacterAction.IDLE); break; default: CharacterAction targetAction = CharacterAction.RUN; float dest = ange; if (CommonFunction.LessZero(dest)) { dest += 360f; } if (ThisActionUnit.CurrentMoveAction == targetAction && CommonFunction.IsZero(_move.Rotation.y - dest) && ThisData.lastMoveType == MoveType.MOVE_ANGE && moveType == MoveType.MOVE_ANGE) { return; } ThisActionUnit.ChangeMoveAction(targetAction); if (moveType == MoveType.MOVE_ANGE) { _move.SetDestRotation(ange, ThisActionUnit.CurrentActionConfig.canRotate); } break; } ThisData.lastMoveType = moveType; UpdateForwardSpeed(); }
public void Init() { _move.Init(); ThisView.Init(); ThisData.Init(); ThisActionUnit.Init(); OnMove(0f, MoveType.STOP); }
public void Release() { TickerManager.Instance.RemoveFixedTick(this); TickerManager.Instance.RemoveTick(this); Init(); ThisConfig = null; ThisActionUnit.Release(); ThisView.Release(); }
public void OnFunctionKeyDown(ushort keyCode) { switch (keyCode) { case InputDefine.FUNCTION_KEY1: ThisActionUnit.NormalAttackKeyDown(); break; } }
public void FixedUpdate(uint fixedTickCount, float delta) { #region 动作切换 ThisActionUnit.Update(delta); #endregion #region 移动相关 if (_move.HaveSpeed) { _move.Move(delta); } if ((_move.position - ThisView.MainTransform.position).magnitude >= 10f) { _move.UpdateViewPosition(); } #endregion }
public void ChangeCharacter(uint roleID) { if (ThisConfig == null || ThisConfig.characterID != roleID) { CharacterConfig config = CharacterConfigManager.Instance.GetCharacterConfig(roleID); if (config != null) { ThisView.ChangeView(config.resName, config); ThisConfig = config; } else { return; } } ThisActionUnit.ChangeAction(CharacterAction.IDLE, true); Init(); }