|
|
@ -29,38 +29,6 @@ AnimationState Ranger::walk_w=RANGER_WALK_W; |
|
|
|
SETUP_CLASS(Ranger) |
|
|
|
SETUP_CLASS(Ranger) |
|
|
|
|
|
|
|
|
|
|
|
void Ranger::OnUpdate(float fElapsedTime){ |
|
|
|
void Ranger::OnUpdate(float fElapsedTime){ |
|
|
|
if(GetState()==SHOOT_ARROW){ |
|
|
|
|
|
|
|
if(attack_cooldown_timer<=ARROW_ATTACK_COOLDOWN-0.3){ |
|
|
|
|
|
|
|
SetState(NORMAL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(retreatTimer>0){ |
|
|
|
|
|
|
|
SetZ(6*sin(PI/RETREAT_TIME*retreatTimer)); |
|
|
|
|
|
|
|
retreatTimer-=fElapsedTime; |
|
|
|
|
|
|
|
if(retreatTimer<=0){ |
|
|
|
|
|
|
|
SetVelocity({}); |
|
|
|
|
|
|
|
SetZ(0); |
|
|
|
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ghostRemoveTimer>0){ |
|
|
|
|
|
|
|
ghostRemoveTimer-=fElapsedTime; |
|
|
|
|
|
|
|
if(ghostRemoveTimer<=0){ |
|
|
|
|
|
|
|
if(ghostPositions.size()>0){ |
|
|
|
|
|
|
|
ghostPositions.erase(ghostPositions.begin()); |
|
|
|
|
|
|
|
if(ghostPositions.size()>0){ |
|
|
|
|
|
|
|
ghostRemoveTimer=RETREAT_GHOST_FRAME_DELAY; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ghostFrameTimer>0){ |
|
|
|
|
|
|
|
ghostFrameTimer-=fElapsedTime; |
|
|
|
|
|
|
|
if(ghostFrameTimer<=0&&GetState()==State::RETREAT){ |
|
|
|
|
|
|
|
ghostPositions.push_back(GetPos()+vf2d{0,-GetZ()}); |
|
|
|
|
|
|
|
ghostFrameTimer=RETREAT_GHOST_FRAME_DELAY; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool Ranger::AutoAttack(){ |
|
|
|
bool Ranger::AutoAttack(){ |
|
|
|