public override void Update() { //if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow)) // SystemMgr.ChangeState(CustomFSMState.Move); SystemMgr.Unit.Progress(); SystemMgr.Unit.Move(0); if (Input.GetAxisRaw("Horizontal") != 0) { SystemMgr.ChangeState(CustomFSMState.Move); } else if (Input.GetKeyDown(KeyCode.C)) { SystemMgr.ChangeState(CustomFSMState.Jump); } else if (Input.GetKeyDown(KeyCode.X)) { SystemMgr.ChangeState(CustomFSMState.Attack); } else if (Input.GetKeyDown(KeyCode.Space)) { SystemMgr.ChangeState(CustomFSMState.Dash); } else if (Input.GetKeyDown(KeyCode.S)) { SystemMgr.ChangeState(CustomFSMState.Skill1); } else if (Input.GetKeyDown(KeyCode.Z)) { SystemMgr.ChangeState(CustomFSMState.Backstep); } }
private void EndOrNextCheck() { if (_attackIndex != _nextAttackIndex) { if (_nextAttackIndex > _attackMaxIndex) { _attackIndex = 0; _nextAttackIndex = 0; } else { _attackIndex = _nextAttackIndex; } //Debug.Log("_nextAttackIndex : " + _nextAttackIndex); //Debug.Log("_attackIndex : " + _attackIndex); SystemMgr.Unit.curAttackIndex = _attackIndex; SystemMgr.Unit.CurAniState = _attackAniIndex[_attackIndex]; } else { //Debug.Log("Idle"); SystemMgr.ChangeState(CustomFSMState.Idle); } }
public override void Update() { SystemMgr.Unit.Progress(); SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal")); if (Input.GetKeyDown(KeyCode.X)) { _attackInputTime = Time.time; if (_attackInputTime - _attackBeInputTime <= _attackTime) { // 1타 > 2타 > 3타. 현재 애니메이션은 끊기면 안됨. _nextAttackIndex = _attackIndex + 1; } _attackBeInputTime = Time.time; } else if (Input.GetKeyDown(KeyCode.Space)) { SystemMgr.ChangeState(CustomFSMState.Dash); } else if (Input.GetKeyDown(KeyCode.S)) { SystemMgr.ChangeState(CustomFSMState.Skill1); } else if (Input.GetKeyDown(KeyCode.Z)) { SystemMgr.ChangeState(CustomFSMState.Backstep); } }
public override void StartState() { if (SystemMgr.Unit.playerShadowUnit.isControlAble == false || SystemMgr.Unit.isSkill1CollTimeOk == false) { SystemMgr.ChangeState(CustomFSMState.Idle); } else { SystemMgr.Unit.Skill1(); SystemMgr.Unit.CurAniState = AniState.Skll1; } }
// 이걸 FSM에서 처리하는게 아니고 키입력을 관리하는 클래스를 만들어서 거기서 관리. // 유닛 컨트롤러라는 매니저 클래스를 하나 만들어서 유닛을 등록해서 키에 따라 행동하도록. public override void Update() { SystemMgr.Unit.Progress(); SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal")); SystemMgr.Unit.CheckMovementDir(); if (Input.GetKeyDown(KeyCode.C)) { SystemMgr.ChangeState(CustomFSMState.Jump); } else if (Input.GetKeyDown(KeyCode.X)) { SystemMgr.ChangeState(CustomFSMState.Attack); } else if (Input.GetKeyDown(KeyCode.Space)) { SystemMgr.ChangeState(CustomFSMState.Dash); } else if (Input.GetKeyDown(KeyCode.S)) { SystemMgr.ChangeState(CustomFSMState.Skill1); } else if (Input.GetKeyDown(KeyCode.Z)) { SystemMgr.ChangeState(CustomFSMState.Backstep); } if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) { _isStartStateTimer = true; } if (_isStartStateTimer) // 키보드를 좌우 연타 했을 때 idle로 넘어가는 시간에 대한 유예 값. { _changeStateTimer -= Time.deltaTime; if (_changeStateTimer >= 0.001f) { if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow)) { _changeStateTimer = 0.25f; _isStartStateTimer = false; return; } } else { SystemMgr.ChangeState(CustomFSMState.Idle); } } }
public override void Update() { SystemMgr.Unit.Progress(); SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal")); if (SystemMgr.Unit.IsGround) { if (Input.GetAxisRaw("Horizontal") == 0) { SystemMgr.ChangeState(CustomFSMState.Idle); } else if (Input.GetAxisRaw("Horizontal") != 0) { SystemMgr.ChangeState(CustomFSMState.Move); } } }
public override void Update() { SystemMgr.Unit.Progress(); SystemMgr.Unit.Move(Input.GetAxisRaw("Horizontal")); if (_jumpCount >= 1 && Input.GetKeyDown(KeyCode.C)) { DoubleJump(); } if (Input.GetKey(KeyCode.C)) { if (_jumpTimeCounter > 0.0f) { SystemMgr.Unit.Jump(_addJumpPower); } _jumpTimeCounter -= Time.deltaTime; } if (Input.GetKeyUp(KeyCode.C)) { _jumpTimeCounter = 0; } else if (Input.GetKeyDown(KeyCode.X)) { SystemMgr.ChangeState(CustomFSMState.JumpAttack); } if (SystemMgr.Unit.IsGround) { if (Input.GetAxisRaw("Horizontal") == 0) { SystemMgr.ChangeState(CustomFSMState.Idle); } else if (Input.GetAxisRaw("Horizontal") != 0) { SystemMgr.ChangeState(CustomFSMState.Move); } } //SystemMgr.Unit.AddJumpGravity(); }
public override void StartState() { _jumpCount = 1; if (SystemMgr.Unit.CoyoteTime >= 0.0f) { _jumpTimeCounter = 0.1f; SystemMgr.Unit.Jump(_jumpPower); _addJumpPower = 1.0f; SystemMgr.Unit.CurAniState = AniState.Jump; //Debug.Log("JumpState Start"); } else { if (_jumpCount >= 1) { DoubleJump(); } else { SystemMgr.ChangeState(CustomFSMState.Idle); } } }