using System; using System.Collections.Generic; using System.Globalization; using Game.Player; using Sirenix.OdinInspector; using TMPro; using UnityEngine; using Random = UnityEngine.Random; namespace Game.Room { [System.Serializable] public class RoomInfo : MonoBehaviour { [ShowInInspector] [ReadOnly] private Room _room; [SerializeField] [ReadOnly] private Vector2 room_LeftDown; [SerializeField] [ReadOnly] private Vector2 room_RightUp; [SerializeField] private SpriteRenderer _renderer; private TMP_Text number; [ShowInInspector] private Transform left; // { // set => this.room_LeftDown = value.position; // get => null; // } [ShowInInspector] private Transform right; // { // set => this.room_RightUp = value.position; // get => null; // } [Button("SetPos")] private void Set() { this.room_LeftDown = left.position; this.room_RightUp = right.position; } public RoomType roomType => this._room.roomType; public Vector2 room_Center => transform.position; private void Awake() { _renderer = this.GetComponent(); this._renderer.enabled = false; number = transform.FindChildDeep("number"); this.number.text = "0"; } public void SetRoom(Room room) { this._room = room; } public Vector2 GetJoinPosition() { var vector2 = this.room_RightUp - this.room_LeftDown; Vector2 vec = new Vector2(Random.Range(0, vector2.x), Random.Range(0, vector2.y)); vec += this.room_LeftDown; return vec; } public void SetSelect(bool isSelected) { _renderer.enabled = isSelected; } public void UpdateNumber(float f) { this.number.text = f.ToString("F"); } } }