/// <summary> /// 修改区域的类型(全部墙或洞) /// </summary> public void SetRegion(CaveRegion region, TileType type) { int x, y; for (int i = 0; i < region.RegionSize; i++) { x = region[i].tileX; y = region[i].tileY; map[x, y] = type; borderedMap[x + borderSize, y + borderSize] = map[x, y]; } }
/// <summary> /// 设置地板纹理物体 /// </summary> /// <returns></returns> public List <GameObject> SetGroundItems(CaveRegion region, uint count, Transform parent) { List <GameObject> objs = new List <GameObject>(); for (int i = 0; i < count; i++) { item = groundItemList.GetRandomItem(); obj = Instantiate(item.prefab, map.GetPosition(region.GetRandomCoord()), Quaternion.Euler(GameMathf.RandomY()), parent); obj.transform.localScale = new Vector3(obj.transform.localScale.x * GameMathf.RandomPlusOrMinus(), obj.transform.localScale.y, obj.transform.localScale.z); objs.Add(obj); } return(objs); }
/// <summary> /// 设置主要物件 /// </summary> public GameObject SetMainItems(CaveRegion region, Transform parent) { float scale = 0f; item = mainItemList.GetRandomItem(region.RegionSize, ref scale, approximate); if (item == null) { item = mainItemList.GetRandomItem(region.RegionSize, ref scale, approximate + 1); } pos = map.GetPosition(region.averageCoord) + item.offset; if (item.randomRotationY) { quat = Quaternion.Euler(GameMathf.RandomY()); } else { quat = Quaternion.Euler(0, GameMathf.RandomNumber(0, 180) - GameMathf.RadianToAngle(Mathf.Atan2(region.deviation.y, region.deviation.x)), 0); } obj = Instantiate(item.prefab, pos, quat, parent); obj.transform.localScale = Vector3.one * scale; return(obj); }
public bool CanEnter(CaveRegion region) { return(region is RockyRegion || region is NarrowRegion); }
public void SetItems(CaveRegion region) { }