dodatna logika
This commit is contained in:
@@ -14,6 +14,9 @@ GAME_ENTITY(Background)
|
||||
public:
|
||||
void render(Game::Renderer::Renderer* renderer, Game::Renderer::RendererConfig config) override;
|
||||
void onWindowResized(int newWidth, int newHeight) override;
|
||||
// Spawn a single trash at the given transform. If seaOnly is true the trash
|
||||
// will be clamped to the sea side of the land boundary.
|
||||
void spawnTrashAt(const Object::Transform& tS, bool seaOnly = false);
|
||||
private:
|
||||
void spawnLevel(int stage);
|
||||
void spawnFriendly(int stage, int count);
|
||||
@@ -22,6 +25,9 @@ GAME_ENTITY(Background)
|
||||
float mLandBoundaryX = 0.f;
|
||||
bool mPendingLevelSpawn = false;
|
||||
int mPendingLevelStage = 0;
|
||||
// Periodic friendly spawn settings
|
||||
float mFriendlySpawnAvgInterval = 6.f; // average seconds between spawns
|
||||
int mMaxAutoFriendlies = 7; // hard cap for total active friendlies
|
||||
std::shared_ptr<Game::Renderer::Texture> mSeaTex;
|
||||
std::shared_ptr<Game::Renderer::Texture> mEnemyTex;
|
||||
std::shared_ptr<Game::Renderer::Texture> mTrashTex;
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace Game::AGame {
|
||||
float mMoveSpeedX = 0.f;
|
||||
float mMoveSpeedY = 0.f;
|
||||
float mDirectionChangeTimer = 0.f;
|
||||
float mShoreSpawnCooldown = 0.f;
|
||||
END_GAME_ENTITY()
|
||||
}
|
||||
@@ -14,5 +14,8 @@ namespace Game::AGame {
|
||||
GAME_ENTITY(Trash)
|
||||
public:
|
||||
void onCollisionEnter(Object::Entity* other) override;
|
||||
void setSeaOnly(bool v) { mSeaOnly = v; }
|
||||
private:
|
||||
bool mSeaOnly = false;
|
||||
END_GAME_ENTITY()
|
||||
}
|
||||
@@ -21,10 +21,13 @@ namespace Game::Object::Components {
|
||||
void start(Object::Entity* thisEntity) override;
|
||||
void update(float deltaTime, Object::Entity* thisEntity) override;
|
||||
|
||||
void setScale(float scale) { mScale = scale; }
|
||||
float getScale() const { return mScale; }
|
||||
BoxColliderBounds getBounds() const { return mBounds; }
|
||||
bool isColliding() const { return !mCollidingWith.empty(); }
|
||||
|
||||
private:
|
||||
float mScale = 1.f;
|
||||
BoxColliderBounds mBounds{0.f, 0.f, 0.f, 0.f};
|
||||
std::unordered_set<Object::Entity*> mCollidingWith; // Track collisions per-entity so enter/stay/exit callbacks remain correct with multiple colliders
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user