1
This commit is contained in:
39
Unity/Scripts/WorldChunk/ObjectChunk.cs
Normal file
39
Unity/Scripts/WorldChunk/ObjectChunk.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user