protected override CharacterAction OnUpdateAction() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; PlayerCharacterControl control = CurrentCharacter.CurrentControl as PlayerCharacterControl; m_Timer += Time.unscaledDeltaTime * player.PlayerTimeScale; if (data.MeleeAtk[m_ComboIndex].ActiveTime <= m_Timer) { //계속 공격하면 콤보! if (control.Attack) { Attack(); return(this); } //대쉬로 캔슬 가능 if (0.1f < control.Move.magnitude && control.Dash) { return(player.DashAction); } } //공격 애니메이션이 끝났으면 끝... if (m_IsMeleeAttackEnd) { return(player.DefaultAction); } return(this); }
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); } }
protected override void OnUpdate() { //사망중일경우(?)는 업데이트같은거 없다. if (GetAction(0) == m_DieAction) { TimeStopProgress.Value = 0; return; } base.OnUpdate(); PlayerCharacterControl control = CurrentControl as PlayerCharacterControl; //탄환이 부족할 시 재충전 타이머 재생 if (BulletCount.Value < data.Bullet_Max) { BulletChargeTimer.Value -= Time.deltaTime; } //시간정지 if (TimeStopCoolDown.Value <= 0 && control.TimeStop) { //만약 이번프레임에 시간정지가 시작된경우 남은 사용시간 초기화 if (!IsUsingTimeStop.Value) { IsUsingTimeStop.Value = true; TimeStopTimer.Value = data.TimeStop_MaxActiveTime; } //시간정지 타이머 흐르기 / 실제 적용 TimeStopProgress.Value += Time.unscaledDeltaTime / data.TimeStop_MsBetweenActive; TimeStopTimer.Value -= Time.unscaledDeltaTime; TimeEnergy.Value -= data.TimeStop_EnergeUseRate * Time.unscaledDeltaTime; } else { //만약 이번프레임에 시간정지가 끝난경우 쿨타임 적용 if (IsUsingTimeStop.Value) { IsUsingTimeStop.Value = false; TimeStopCoolDown.Value = data.TimeStop_CoolDown; } //쿨타임 흐르기 / 실제 적용 TimeStopProgress.Value -= Time.unscaledDeltaTime / data.TimeStop_MsBetweenEnd; TimeStopCoolDown.Value -= Time.unscaledDeltaTime; } }
private bool m_IsDashEnd; //대쉬 애니메이션이 끝났는지 (끝나면 바로 다시 Default로 돌아감) #endregion #region Event protected override void OnStartAction() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; PlayerCharacterControl control = CurrentCharacter.CurrentControl as PlayerCharacterControl; //초기값들 설정 m_Timer = 0; m_DashDirection = control.Move; m_IsDashEnd = false; m_IsDashStarted = false; //플레이어를 해당 위치를 보도록 만들기 player.SetLookVector(m_DashDirection, true); //회피효과 코루틴 실행 m_AvoidCoroutine = StartCoroutine(AvoidCoroutine()); }
protected override CharacterAction OnUpdateAction() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; PlayerCharacterControl control = player.CurrentControl as PlayerCharacterControl; //Attack if (control.Attack) { if (player.IsWeaponRange.Value) { if (0 < player.BulletCount.Value) { return(player.AttackRangeAction); } else { return(player.DefaultAction); } } else { return(player.AttackMeleeAction); } } //Switch Weapon if (control.SwitchWeapon) { return(player.SwitchAction); } //Dash, Default if (0.1f < control.Move.magnitude) { if (control.Dash) { return(player.DashAction); } else { return(player.DefaultAction); } } return(this); }
protected override CharacterAction OnUpdateAction() { PlayerCharacter player = CurrentCharacter as PlayerCharacter; PlayerCharacterControl control = player.CurrentControl as PlayerCharacterControl; //원거리공격은 아무때나 캔슬 가능함! CharacterAction action = base.OnUpdateAction(); if (action != this) { return(action); } //그리고 마우스 떼면 캔슬함 if (!control.Attack) { return(player.DefaultAction); } //총알이 있는 경우만 계속 진행 if (0 < player.BulletCount.Value) { //플레이어를 마우스방향을 보게 만들기 player.SetLookVector(control.AttackDirection, true); //실제 발사 처리 m_AttackTimer += Time.unscaledDeltaTime * player.PlayerTimeScale; if (!m_IsAttacked && m_AttackTimer < data.RangedAtk_MsBetweenShot) { m_IsAttacked = true; player.BulletCount.Value -= 1; Attack(control.AttackDirection); } } //총알없으면 기본액션으로 돌아감... else { return(player.DefaultAction); } return(this); }