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;
60 [[nodiscard]] u32 loadFlags()
const override {
71 void calcFloor()
override;
82 bool m_endedRailSegment;
83 AnmType m_state1AnmType;
86 static constexpr std::array<StateManagerEntry, 3> STATE_ENTRIES = {{
87 {StateEntry<ObjectCowLeader, &ObjectCowLeader::enterWait, &ObjectCowLeader::calcWait>(
89 {StateEntry<ObjectCowLeader, &ObjectCowLeader::enterEat, &ObjectCowLeader::calcEat>(1)},
90 {StateEntry<ObjectCowLeader, &ObjectCowLeader::enterRoam, &ObjectCowLeader::calcRoam>(
103 void init()
override;
104 void calc()
override;
107 [[nodiscard]] u32 loadFlags()
const override {
112 void loadRail()
override {}
116 void enterFreeRoam();
117 void enterFollowLeader();
121 void calcFollowLeader();
130 static constexpr f32 BASE_TOP_SPEED = 2.0f;
131 static constexpr f32 TOP_SPEED_VARIANCE = 4.0f - 2.0f;
136 static constexpr std::array<StateManagerEntry, 3> STATE_ENTRIES = {{
138 &ObjectCowFollower::calcWait>(0)},
140 &ObjectCowFollower::calcFreeRoam>(1)},
142 &ObjectCowFollower::calcFollowLeader>(2)},
155 void init()
override;
156 void calc()
override;
159 [[nodiscard]] u32 loadFlags()
const override {
164 void createCollision()
override {}
167 void loadRail()
override {}
173 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.
Base class that represents different "states" for an object.
The highest level abstraction for a kart.