Monster Animations and monster flipping according to which wall it's coming from

This commit is contained in:
DamianCorazza
2025-10-14 21:00:03 +02:00
parent 1237f41265
commit 782e068575
75 changed files with 6209 additions and 152 deletions

View File

@@ -316,6 +316,15 @@ namespace Minigames.DivingForPictures
{
// Parent the monster to the spawn point so it moves with the tile
monsterObj.transform.SetParent(spawnPoint);
// Flip the spawn point in X axis if facesLeft is true
MonsterSpawnPoint msp = spawnPoint.GetComponent<MonsterSpawnPoint>();
if (msp != null && msp.facesLeft)
{
Vector3 scale = spawnPoint.localScale;
scale.x *= -1f;
spawnPoint.localScale = scale;
}
// Fire event
OnMonsterSpawned?.Invoke(monster);

View File

@@ -189,5 +189,6 @@ namespace Minigames.DivingForPictures
detectionCollider = GetComponent<CircleCollider2D>();
}
#endif
}
}

View File

@@ -7,6 +7,9 @@ namespace Minigames.DivingForPictures
[Tooltip("Visual radius for spawn point in editor")]
public float gizmoRadius = 0.5f;
[Tooltip("If true, spawn point will face left (flipped in X axis)")]
public bool facesLeft = false;
// Visual indicator for editor only
private void OnDrawGizmos()
{