BITKit/Packages/Common~/Scripts/WorldChunk/ObjectChunk.cs

39 lines
866 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
namespace BITKit.WorldChunk
{
public class ObjectChunk : WorldChunk
{
public Vector2 size;
public Renderer[] renderers;
Vector2 posCenter
{
get
{
var pos = transform.position;
return new()
{
x = pos.x,
y = pos.z,
};
}
}
public override Rect GetRect()
{
return new()
{
position = posCenter,
size = size,
};
}
public override void SetActive(bool active)
{
renderers.ForEach(x =>
{
x.enabled = active;
});
}
}
}