inline void crouch() { if(crouching || isInAir()) return; cPhys->setPos(cPhys->getPosI() + getCrouchDiffVec()); cPhys->setHeight(toCr(fc.heightCrouching)); crouching = true; }
bool PxVehicleWheels::isInAir() const { for(PxU32 i=0;i<mWheelsSimData.getNumWheels();i++) { if(!isInAir(i)) { return false; } } return true; }
inline void update(FT mFT) override { if(isInAir()) { action = (body->getVelocity().y > 0) ? Action::Fall : Action::Jump; } else { action = crouching ? Action::Crouch : Action::Stand; } movStatus = (std::abs(body->getVelocity().x) < 100) ? MovStatus::Stop : MovStatus::Move; if(atkDelay > 0.f) { atkStatus = AtkStatus::Attack; atkDelay -= mFT; } else { atkStatus = AtkStatus::Idle; } }
inline void jump() { if(isInAir() || crouching) return; body->applyAccel(Vec2f(0.f, -toCr(fc.jumpStrength))); }