반응형
PickableAbility.cs
protected override void Pick(GameObject picker)
{
if (_character == null)
{
return;
}
bool newState = (Method == Methods.Permit);
CharacterAbility ability = _character.FindAbilityByString(AbilityTypeAsString);
if (ability != null)
{
ability.PermitAbility(newState);
}
}
ability.PermitAbility(newState);
AbilityPermitted 와 추가 조건들을 더해서 AbilityAuthorized 변수가 Ability의 발현 여부를 결정
CharacterAbility.cs
public virtual void PermitAbility(bool abilityPermitted)
{
AbilityPermitted = abilityPermitted;
}
public virtual bool AbilityAuthorized
{
get
{
if (_character != null)
{
if ((BlockingMovementStates != null) && (BlockingMovementStates.Length > 0))
{
for (int i = 0; i < BlockingMovementStates.Length; i++)
{
if (BlockingMovementStates[i] == (_character.MovementState.CurrentState))
{
return false;
}
}
}
if ((BlockingConditionStates != null) && (BlockingConditionStates.Length > 0))
{
for (int i = 0; i < BlockingConditionStates.Length; i++)
{
if (BlockingConditionStates[i] == (_character.ConditionState.CurrentState))
{
return false;
}
}
}
}
return AbilityPermitted;
}
}
AbilityAuthorized
CharacterDash3D.cs
protected override void HandleInput()
{
base.HandleInput();
if (!AbilityAuthorized
|| (!Cooldown.Ready())
|| (_condition.CurrentState != CharacterStates.CharacterConditions.Normal))
{
return;
}
if (!AllowDashWhenJumping && (_movement.CurrentState == CharacterStates.MovementStates.Jumping))
{
return;
}
if (_inputManager.DashButton.State.CurrentState == MMInput.ButtonStates.ButtonDown)
{
DashStart();
}
}
AbilityAuthorized
반응형
'Unity > TopdownEngine' 카테고리의 다른 글
데미지 숫자 표시 (0) | 2023.01.28 |
---|---|
주인공 죽음 및 GameOver Canvas 처리 (0) | 2023.01.28 |
Weapon 발사 시 뒤로 밀려나는 반동(recoil) (0) | 2023.01.28 |
주인공 초기 시작 Weapon(Item) (0) | 2023.01.28 |
Auto Aim & Auto Shot (Weapon) (0) | 2023.01.27 |