protected override CharacterAction OnUpdateAction() { //사용할 값들 캐스팅 (에러나면 게임작동하면 안되니까 그냥 예외처리 없음) PlayerCharacterControl control = CurrentCharacter.CurrentControl as PlayerCharacterControl; PlayerCharacter player = CurrentCharacter as PlayerCharacter; CharacterPhysicCharacterController physic = player.ChildPhysic as CharacterPhysicCharacterController; //기본 업데이트 (다른 액션으로 이동 처리) CharacterAction action = base.OnUpdateAction(); if (action != this) { return(action); } //Move if (0.1f < control.Move.magnitude) { CurrentAni.PlayAnimation("Move"); player.SetLookVector(control.Move, false); physic.Move(control.Move); } //Idle else { CurrentAni.PlayAnimation("Idle"); } return(this); }
//Private /// <summary> /// 공격하는 함수 /// </summary> private void Attack() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; PlayerCharacterControl control = CurrentCharacter.CurrentControl as PlayerCharacterControl; m_ComboIndex = (m_ComboIndex + 1) % data.MeleeAtk.Length; CurrentAni.PlayAnimation($"Attack_Melee_{m_ComboIndex}", true); m_Timer = 0; if (m_ComboIndex == 0) { player.SetLookVector(control.AttackDirection, true); } }
private bool m_IsSwitched; //실제 스위치 처리를 했는지 #endregion #region Event protected override void OnStartAction() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; //기본 초기화 m_Timer = 0; m_IsSwitched = false; //무기 변경 애니메이션 재생 if (player.IsWeaponRange.Value) { CurrentAni.PlayAnimation("Switch_RangeToMelee"); } else { CurrentAni.PlayAnimation("Switch_MeleeToRange"); } }
protected override void OnEndAction() { //원거리 공격 끝!! CurrentAni.PlayAnimation("Attack_Range_End"); }