最终整理版
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
struct SpawnPoint {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
};
|
||||
|
||||
struct SpawnArea {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float width = 0.0f;
|
||||
float height = 0.0f;
|
||||
};
|
||||
|
||||
SpawnArea EffectiveSpawnArea(SpawnArea area);
|
||||
SpawnArea ResolveSpawnArea(SpawnArea objectArea, float mapWidthPixels, float mapHeightPixels);
|
||||
bool SpawnAreaContains(SpawnArea area, SpawnPoint point);
|
||||
SpawnPoint ClampToSpawnArea(SpawnArea area, SpawnPoint point);
|
||||
SpawnPoint ApplySpawnDrift(SpawnArea area, SpawnPoint position, SpawnPoint drift);
|
||||
int MonsterSpawnCount(std::optional<int> count, std::optional<int> maxBeings);
|
||||
float MonsterRespawnDelay(std::optional<float> configuredDelay);
|
||||
float TickRespawnTimer(float currentTimer, float deltaSeconds);
|
||||
bool RespawnTimerReady(float currentTimer);
|
||||
double MonsterRespawnUntil(double nowSeconds, float respawnDelaySeconds);
|
||||
float RemainingRespawnTime(double nowSeconds, double respawnUntilSeconds);
|
||||
bool RespawnDue(double nowSeconds, double respawnUntilSeconds);
|
||||
std::string FallbackMonsterNameForMap(const std::string& mapName);
|
||||
int FallbackMonsterSpawnCount(const std::string& mapName);
|
||||
bool ShouldAddFallbackMonsters(const std::string& mapName, bool sawMonsterSpawn);
|
||||
unsigned int StableSpawnSeed(const std::string& mapName, const std::string& objectName, int objectId);
|
||||
SpawnPoint RandomPointInSpawnArea(SpawnArea area, std::mt19937& rng);
|
||||
std::optional<SpawnPoint> FindWalkableSpawnPoint(
|
||||
SpawnArea area,
|
||||
std::mt19937& rng,
|
||||
const std::function<bool(SpawnPoint)>& isWalkable,
|
||||
int randomAttempts = 24,
|
||||
float fallbackStep = 32.0f);
|
||||
Reference in New Issue
Block a user