|
|
|
@ -315,13 +315,13 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
castInfo.castTimer-=fElapsedTime; |
|
|
|
|
if(castInfo.castTimer<=0){ |
|
|
|
|
bool allowed=castPrepAbility->actionPerformedDuringCast; |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
if(!allowed&&castPrepAbility->action(this,castInfo.castPos))allowed=true; |
|
|
|
|
if(allowed){ |
|
|
|
|
castPrepAbility->cooldown=castPrepAbility->GetCooldownTime(); |
|
|
|
|
ConsumeMana(castPrepAbility->manaCost); |
|
|
|
|
} |
|
|
|
|
castInfo.castTimer=0; |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -605,6 +605,9 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
|
|
|
|
|
#pragma region Ranger |
|
|
|
|
if(GetState()==State::SHOOT_ARROW){ |
|
|
|
|
if(rangerShootAnimationTimer>0.f){ |
|
|
|
|
rangerShootAnimationTimer=std::max(0.f,rangerShootAnimationTimer-fElapsedTime); |
|
|
|
|
}else |
|
|
|
|
if(attack_cooldown_timer<=ARROW_ATTACK_COOLDOWN-0.3){ |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
} |
|
|
|
@ -773,9 +776,9 @@ void Player::AddAnimation(std::string state){ |
|
|
|
|
animation.AddState(state,ANIMATION_DATA.at(state)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::UpdateAnimation(std::string animState,int specificClass,const bool force){ |
|
|
|
|
void Player::UpdateAnimation(std::string animState,int specificClass){ |
|
|
|
|
if(specificClass==ANY||specificClass&GetClass()){ |
|
|
|
|
animation.ChangeState(internal_animState,animState,force); |
|
|
|
|
animation.ChangeState(internal_animState,animState); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -974,31 +977,31 @@ void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){ |
|
|
|
|
case Class::WARRIOR: |
|
|
|
|
case Class::THIEF:{ |
|
|
|
|
if(FacingNorth()){ |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_N",true); |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_N"); |
|
|
|
|
}else |
|
|
|
|
if(FacingSouth()){ |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_S",true); |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_S"); |
|
|
|
|
}else
|
|
|
|
|
if(FacingWest()){ |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_W",true); |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_W"); |
|
|
|
|
}else |
|
|
|
|
if(FacingEast()){ |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_E",true); |
|
|
|
|
UpdateAnimation("WARRIOR_SWINGSWORD_E"); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case Class::RANGER: |
|
|
|
|
case Class::TRAPPER:{ |
|
|
|
|
if(FacingNorth()){ |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_N",true); |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_N"); |
|
|
|
|
}else |
|
|
|
|
if(FacingSouth()){ |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_S",true); |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_S"); |
|
|
|
|
}else
|
|
|
|
|
if(FacingWest()){ |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_W",true); |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_W"); |
|
|
|
|
}else |
|
|
|
|
if(FacingEast()){ |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_E",true); |
|
|
|
|
UpdateAnimation("RANGER_SHOOT_E"); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|