enemies face south
This commit is contained in:
parent
49ce33b162
commit
d7700248fa
1 changed files with 12 additions and 3 deletions
|
|
@ -414,7 +414,7 @@ namespace TD.Gameplay
|
|||
// PlayerZoneVolume (so OwnerGrid[spawnerTile] = None).
|
||||
var spawner = zone.Spawners[0];
|
||||
(float xHalf, float zHalf) = ComputeSpawnerHalfExtents(spawner.TileArea);
|
||||
SpawnEnemy(def, spawner.TilePosition, zone.Owner, xHalf, zHalf, held);
|
||||
SpawnEnemy(def, spawner.TilePosition, zone.Owner, xHalf, zHalf, held, spawner.Facing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -440,7 +440,8 @@ namespace TD.Gameplay
|
|||
}
|
||||
|
||||
private void SpawnEnemy(EnemyDefinition def, Vector2Int spawnerTile, PlayerSlot ownerSlot,
|
||||
float xHalfExtent = 0f, float zHalfExtent = 0f, bool held = false)
|
||||
float xHalfExtent = 0f, float zHalfExtent = 0f, bool held = false,
|
||||
Direction facing = Direction.South)
|
||||
{
|
||||
if (def.EnemyPrefab == null)
|
||||
{
|
||||
|
|
@ -454,7 +455,15 @@ namespace TD.Gameplay
|
|||
if (zHalfExtent > 0f)
|
||||
spawnPos.z += Random.Range(-zHalfExtent, zHalfExtent);
|
||||
|
||||
var go = Instantiate(def.EnemyPrefab, spawnPos, Quaternion.identity);
|
||||
float yaw = facing switch
|
||||
{
|
||||
Direction.North => 0f,
|
||||
Direction.East => 90f,
|
||||
Direction.South => 180f,
|
||||
Direction.West => 270f,
|
||||
_ => 0f,
|
||||
};
|
||||
var go = Instantiate(def.EnemyPrefab, spawnPos, Quaternion.Euler(0f, yaw, 0f));
|
||||
|
||||
var health = go.GetComponent<EnemyHealth>();
|
||||
var movement = go.GetComponent<EnemyMovement>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue