3#include "game/field/StateManager.hh"
4#include "game/field/obj/ObjectCollidable.hh"
16 Kart::Reaction onCollision(
Kart::KartObject *kartObj, Kart::Reaction reactionOnKart,
17 Kart::Reaction reactionOnObj,
EGG::Vector3f &hitDepth)
override;
20 virtual void calcFloor();
29 return v0 + (v1 - v0) * t;
63 [[nodiscard]]
u32 loadFlags()
const override {
74 void calcFloor()
override;
85 bool m_endedRailSegment;
86 AnmType m_state1AnmType;
89 static constexpr std::array<StateManagerEntry<ObjectCowLeader>, 3> STATE_ENTRIES = {{
90 {0, &ObjectCowLeader::enterWait, &ObjectCowLeader::calcWait},
91 {1, &ObjectCowLeader::enterEat, &ObjectCowLeader::calcEat},
92 {2, &ObjectCowLeader::enterRoam, &ObjectCowLeader::calcRoam},
96class ObjectCowFollower;
107 void init()
override;
108 void calc()
override;
111 [[nodiscard]]
u32 loadFlags()
const override {
116 void loadRail()
override {}
120 void enterFreeRoam();
121 void enterFollowLeader();
125 void calcFollowLeader();
134 static constexpr f32 BASE_TOP_SPEED = 2.0f;
135 static constexpr f32 TOP_SPEED_VARIANCE = 4.0f - 2.0f;
140 static constexpr std::array<StateManagerEntry<ObjectCowFollower>, 3> STATE_ENTRIES = {{
141 {0, &ObjectCowFollower::enterWait, &ObjectCowFollower::calcWait},
142 {1, &ObjectCowFollower::enterFreeRoam, &ObjectCowFollower::calcFreeRoam},
143 {2, &ObjectCowFollower::enterFollowLeader, &ObjectCowFollower::calcFollowLeader},
156 void init()
override;
157 void calc()
override;
160 [[nodiscard]]
u32 loadFlags()
const override {
165 void createCollision()
override {}
168 void loadRail()
override {}
174 std::span<ObjectCowFollower *> m_followers;
A cow that follows a leader by sharing the same rail.
u16 m_waitFrames
Number of frames the cow will stand still for.
static constexpr f32 DIST_THRESHOLD
Distance at which a cow is considered close enough to the rail to stop moving.
f32 m_railSegThreshold
The rail segmentT at which a cow will change to state 2.
f32 m_topSpeed
The speed the cow will accelerate up to.
bool m_bStopping
Set when the cow is coming to a stop.
The manager class that controls a group of cows.
void checkCollision()
Prevents cows from walking into each other.
void init() override
Assigns the herd's rail to each child.
A cow who its own rail and whose position is not influenced by the path of the others.
u16 m_eatFrames
Length of the state 1 eat animation.
The base class shared between ObjectCowLeader and ObjectCowFollower.
EGG::Vector3f m_upForce
Used by calcPos to counteract gravity.
u32 m_startFrame
The frame the cow will start moving.
EGG::Vector3f m_state1TargetPos
Calculated in enterState1.
f32 m_xzSpeed
XZ plane length of m_velocity.
The highest level abstraction for a kart.