Monster Animations and monster flipping according to which wall it's coming from
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -189,5 +189,6 @@ namespace Minigames.DivingForPictures
|
||||
detectionCollider = GetComponent<CircleCollider2D>();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user