Frame/Assets/Scripts/Room/RoomInfo.cs

46 lines
1.2 KiB
C#

using System.Collections.Generic;
using Game.Player;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Game.Room
{
public class RoomInfo : MonoBehaviour
{
[SerializeField] [ReadOnly] private IRoom _room;
[SerializeField] [ReadOnly] private Vector2 room_LeftDown;
[SerializeField] [ReadOnly] private Vector2 room_RightUp;
[ShowInInspector]
private Transform left
{
set => this.room_LeftDown = value.position;
get => null;
}
[ShowInInspector]
private Transform right
{
set => this.room_RightUp = value.position;
get => null;
}
public RoomType roomType => this._room.roomType;
public Vector2 room_Center => transform.position;
public void SetRoom(IRoom 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;
}
}
}