Ejemplo n.º 1
0
    public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
    {
        base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
        float noise = (genHeight - biomeInfo.min_height) / biomeInfo.amplitude;

        if (noise >= 0.9f)
        {
            if (localPos.y >= genHeight - 3)
            {
                return(BlockTypeEnum.None);
            }
            else if (localPos.y > 20 && localPos.y < genHeight - 1)
            {
                return(BlockTypeEnum.Magma);
            }
            else
            {
                return(BlockTypeEnum.StoneVolcanic);
            }
        }
        if (genHeight == localPos.y)
        {
            AddDeadwood(wPos);
            AddFireFlower(wPos);
        }
        return(BlockTypeEnum.StoneVolcanic);
    }
Ejemplo n.º 2
0
 public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
 {
     base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
     if (wPos.y == genHeight)
     {
         AddCactus(wPos);
         AddWeed(wPos);
         AddFlower(wPos);
     }
     if (wPos.y <= genHeight && wPos.y > genHeight - 30)
     {
         return(BlockTypeEnum.Sand);
     }
     if (wPos.y <= genHeight - 30 && wPos.y > genHeight - 35)
     {
         return(BlockTypeEnum.Dirt);
     }
     else if (wPos.y == 0)
     {
         //基础
         return(BlockTypeEnum.Foundation);
     }
     else
     {
         return(BlockTypeEnum.Stone);
     }
 }
Ejemplo n.º 3
0
 public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
 {
     base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
     if (wPos.y == genHeight)
     {
         AddWeed(wPos);
         AddFlower(wPos);
         AddTree(wPos);
         AddBigTree(wPos);
         // 地表,使用草
         return(BlockTypeEnum.Grass);
     }
     if (wPos.y < genHeight && wPos.y > genHeight - 10)
     {
         //中使用泥土
         return(BlockTypeEnum.Dirt);
     }
     else if (wPos.y == 0)
     {
         //基础
         return(BlockTypeEnum.Foundation);
     }
     else
     {
         //其他石头
         return(BlockTypeEnum.Stone);
     }
 }
Ejemplo n.º 4
0
 public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
 {
     if (wPos.y == genHeight)
     {
         //AddWeed(wPos);
         //AddBigTree(wPos);
         //AddWorldTree(wPos);
         //AddMushroomTree(wPos);
         //AddStoneMoss(wPos);
         //AddFlower(wPos);
         //AddDeadwood(wPos);
         //草
         return(BlockTypeEnum.Grass);
     }
     else if (wPos.y == 0)
     {
         //基础
         return(BlockTypeEnum.Foundation);
     }
     else if (wPos.y < genHeight && wPos.y >= genHeight - 5)
     {
         //其他土
         return(BlockTypeEnum.Dirt);
     }
     else
     {
         //BiomeCreateTool.AddOre(900, 0.00001f, wPos);
         //其他土
         return(BlockTypeEnum.Stone);
     }
 }
Ejemplo n.º 5
0
    public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
    {
        base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
        int trueHeight = BiomeHandler.Instance.GetHeightData(wPos, 0.025f, 30f, 30);

        if (wPos.y == trueHeight)
        {
            AddFlower(wPos);
            return(BlockTypeEnum.Dirt);
        }
        if (wPos.y < trueHeight && wPos.y > trueHeight - 2)
        {
            //中使用泥土
            return(BlockTypeEnum.Dirt);
        }
        else if (wPos.y == 0)
        {
            //基础
            return(BlockTypeEnum.Foundation);
        }
        else if (wPos.y <= trueHeight - 2)
        {
            //石头
            return(BlockTypeEnum.Stone);
        }
        else
        {
            //海水
            return(BlockTypeEnum.Water);
        }
    }
Ejemplo n.º 6
0
 /// <summary>
 /// 初始化生态信息
 /// </summary>
 /// <param name="listData"></param>
 public void InitBiomeInfo(List <BiomeInfoBean> listData)
 {
     for (int i = 0; i < listData.Count; i++)
     {
         BiomeInfoBean itemInfo = listData[i];
         arrayBiomeInfo[itemInfo.id] = itemInfo;
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 获取高度信息
 /// </summary>
 /// <param name="wPos"></param>
 /// <param name="biomeInfo"></param>
 /// <returns></returns>
 public int GetHeightData(Vector3Int wPos, BiomeInfoBean biomeInfo)
 {
     if (biomeInfo == null)
     {
         return(10);
     }
     return(GetHeightData(wPos, biomeInfo.frequency, biomeInfo.amplitude, biomeInfo.min_height));
 }
Ejemplo n.º 8
0
    /// <summary>
    /// 获取游戏数据
    /// </summary>
    /// <returns></returns>
    public BiomeInfoBean GetBiomeInfoData()
    {
        BiomeInfoBean data = serviceBiomeInfo.QueryData();

        if (data == null)
        {
            data = new BiomeInfoBean();
        }
        return(data);
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 更新数据
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    public bool UpdateData(BiomeInfoBean data)
    {
        bool deleteState = BaseDeleteDataById(data.id);

        if (deleteState)
        {
            bool insertSuccess = BaseInsertData(tableNameForMain, data);
            return(insertSuccess);
        }
        return(false);
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 获取数据
    /// </summary>
    /// <param name="action"></param>
    /// <returns></returns>
    public BiomeInfoBean GetBiomeInfoData(Action <BiomeInfoBean> action)
    {
        BiomeInfoBean data = GetModel().GetBiomeInfoData();

        if (data == null)
        {
            GetView().GetBiomeInfoFail("没有数据", null);
            return(null);
        }
        GetView().GetBiomeInfoSuccess <BiomeInfoBean>(data, action);
        return(data);
    }
Ejemplo n.º 11
0
 /// <summary>
 /// 生态列表UI
 /// </summary>
 /// <param name="listData"></param>
 protected void UIForBiomeList(List <BiomeInfoBean> listData)
 {
     if (listData.IsNull())
     {
         return;
     }
     for (int i = 0; i < listData.Count; i++)
     {
         GUILayout.Space(50);
         BiomeInfoBean itemBiomeInfo = listData[i];
         UIForBiomeItem(false, itemBiomeInfo);
     }
 }
Ejemplo n.º 12
0
 public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
 {
     base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
     if (wPos.y == genHeight)
     {
         if (wPos.y >= biomeInfo.GetWaterPlaneHeight())
         {
             AddWeed(wPos);
             AddBigTree(wPos);
             AddWorldTree(wPos);
             AddMushroomTree(wPos);
             AddStoneMoss(wPos);
             AddFlower(wPos);
             AddDeadwood(wPos);
         }
         if (wPos.y == biomeInfo.GetWaterPlaneHeight() || wPos.y == biomeInfo.GetWaterPlaneHeight() + 1)
         {
             // 地表,使用草
             return(BlockTypeEnum.Sand);
         }
         else
         {
             // 地表,使用草
             return(BlockTypeEnum.GrassMagic);
         }
     }
     if (wPos.y < genHeight && wPos.y > genHeight - 10)
     {
         //中使用泥土
         return(BlockTypeEnum.Dirt);
     }
     else if (wPos.y == 0)
     {
         //基础
         return(BlockTypeEnum.Foundation);
     }
     else
     {
         //其他石头
         return(BlockTypeEnum.Stone);
     }
 }
Ejemplo n.º 13
0
    public override BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
    {
        base.GetBlockType(chunk, biomeInfo, genHeight, localPos, wPos);
        if (wPos.y == genHeight)
        {
            if (wPos.x <= 3 && wPos.x >= -3 && wPos.z <= 4 && wPos.z >= -10)
            {
            }
            else
            {
                AddWeed(wPos);
                AddFlower(wPos);
                AddTree(wPos);
            }

            // 地表,使用草
            return(BlockTypeEnum.Grass);
        }
        else
        {
            //其他石头
            return(BlockTypeEnum.Stone);
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    ///   生态展示UI
    /// </summary>
    /// <param name="isCreate"></param>
    /// <param name="biomeInfo"></param>
    protected void UIForBiomeItem(bool isCreate, BiomeInfoBean biomeInfo)
    {
        if (biomeInfo == null)
        {
            return;
        }
        GUILayout.BeginHorizontal();
        if (isCreate)
        {
            if (EditorUI.GUIButton("创建生态", 150))
            {
                biomeInfo.link_id = biomeInfo.id;
                biomeInfo.valid   = 1;
                bool isSuccess = serviceForBiomeInfo.UpdateData(biomeInfo);
                if (!isSuccess)
                {
                    LogUtil.LogError("创建失败");
                }
            }
        }
        else
        {
            if (EditorUI.GUIButton("更新生态", 150))
            {
                biomeInfo.link_id = biomeInfo.id;
                bool isSuccess = serviceForBiomeInfo.UpdateData(biomeInfo);
                if (!isSuccess)
                {
                    LogUtil.LogError("更新失败");
                }
            }
            if (EditorUI.GUIButton("删除生态", 150))
            {
                bool isSuccess = serviceForBiomeInfo.DeleteData(biomeInfo.id);
                if (isSuccess)
                {
                    listQueryData.Remove(biomeInfo);
                }
                else
                {
                    LogUtil.LogError("删除失败");
                }
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        EditorUI.GUIText("生态Id", 50);
        biomeInfo.id = EditorUI.GUIEditorText(biomeInfo.id);
        EditorUI.GUIText("名字", 50);
        biomeInfo.name_cn = EditorUI.GUIEditorText(biomeInfo.name_cn);
        biomeInfo.name_en = EditorUI.GUIEditorText(biomeInfo.name_en);
        biomeInfo.id      = (int)EditorUI.GUIEnum <BiomeTypeEnum>("生态类型:", (int)biomeInfo.id);
        EditorUI.GUIText("频率", 50);
        biomeInfo.frequency = EditorUI.GUIEditorText(biomeInfo.frequency);
        EditorUI.GUIText("振幅", 50);
        biomeInfo.amplitude = EditorUI.GUIEditorText(biomeInfo.amplitude);
        EditorUI.GUIText("最小高度(默认50)", 150);
        biomeInfo.min_height = EditorUI.GUIEditorText(biomeInfo.min_height);
        EditorUI.GUIText("大小", 50);
        biomeInfo.scale = EditorUI.GUIEditorText(biomeInfo.scale);
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 15
0
 /// <summary>
 /// 保存游戏数据
 /// </summary>
 /// <param name="data"></param>
 public void SetBiomeInfoData(BiomeInfoBean data)
 {
     serviceBiomeInfo.UpdateData(data);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 获取方块类型
 /// </summary>
 /// <param name="genHeight"></param>
 /// <returns></returns>
 public virtual BlockTypeEnum GetBlockType(Chunk chunk, BiomeInfoBean biomeInfo, int genHeight, Vector3Int localPos, Vector3Int wPos)
 {
     return(BlockTypeEnum.Stone);
 }
Ejemplo n.º 17
0
 public Biome(BiomeTypeEnum biomeType)
 {
     this.biomeType = biomeType;
     biomeInfo      = BiomeHandler.Instance.manager.GetBiomeInfo(this.biomeType);
 }