| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using UnityEngine;
- namespace MazeGen
- {
- /// <summary>
- /// Visual representation of a single monster instance in a room.
- /// This is a placeholder using a colored circle - replace with real art later.
- /// </summary>
- [RequireComponent(typeof(SpriteRenderer))]
- public class MonsterView : MonoBehaviour
- {
- private MonsterEncounter.MonsterInstance _monsterData;
- public void Initialize(MonsterEncounter.MonsterInstance monsterData, Vector2 position)
- {
- _monsterData = monsterData;
- transform.position = position;
- transform.localScale = Vector3.one * 0.3f; // Smaller than rooms
- var sr = GetComponent<SpriteRenderer>();
- sr.sprite = RoomView.SharedSquareSprite;
- sr.color = _monsterData.Template.Color;
- gameObject.name = $"Monster_{_monsterData.Template.MonsterName}";
- }
- /// <summary>
- /// Called when this monster is defeated - fade out or destroy visually.
- /// </summary>
- public void OnDefeated()
- {
- // Simple fade out and destroy (you can add animations later)
- Destroy(gameObject);
- }
- public MonsterEncounter.MonsterInstance MonsterData => _monsterData;
- }
- }
|