Beispiel #1
0
    /// <summary>
    /// 创建建筑
    /// </summary>
    void CreateBuilding(BuildInfo roomBuild)
    {
        // 创建地形
        if (roomBuild == null)
        {
            return;
        }

        GameObject dropHeroChild = new GameObject("dropHeroChild");

        dropHeroChild.transform.parent = MyHead.BtnClickTrap.transform;

        Vector2 size      = new Vector2(roomBuild.m_Shape.width, roomBuild.m_Shape.height);
        Vector3 pos       = new Vector3(-50f * size.x, -47.6f, -600f);
        Vector3 scaleSize = new Vector3(35f, 35f, 35f);

        if (size.y >= 2)
        {
            scaleSize = new Vector3(20f, 20f, 20f);
            pos       = new Vector3(-50f * size.x + 20f, -47.6f, -600f);
        }

        dropHeroChild.transform.localPosition = pos;
        dropHeroChild.transform.localScale    = scaleSize;

        Vector3 local = Vector3.zero;
        Vector3 world = dropHeroChild.transform.TransformPoint(local);

        roomBuild.m_cx = 0;
        roomBuild.m_cy = 0;
        m_buildlife    = LifeFactory.CreateBuilding(roomBuild, 0, dropHeroChild.transform, world, LifeEnvironment.View);
        if (m_buildlife != null)
        {
            m_buildlife.PlayViewAni();
            if (roomBuild.BuildType == 1605)
            {
                ParticleEffect effect = m_buildlife.m_thisT.gameObject.AddComponent <ParticleEffect>();
                effect.EnabelScale = true;
            }
        }
        // 创建房间外壳
        if (roomBuild.m_RoomType != RoomType.DeckTrap)   //非甲板房间需加壳
        {
            GenerateShip.GenerateShipBuildingShell(dropHeroChild.transform, roomBuild.GetBuildCanvasInfo());
        }

        GameObjectLoader.SetGameObjectLayer(dropHeroChild, gameObject.layer);
    }
Beispiel #2
0
    /// <summary>
    /// 创建建筑
    /// </summary>
    void CreateBuilding(BuildInfo roomBuild)
    {
        // 创建地形
        if (roomBuild == null)
        {
            return;
        }
        GameObject dropHeroChild = new GameObject("dropHeroChild");

        dropHeroChild.transform.parent = MyHead.DropHero;
        Vector2 size      = new Vector2(roomBuild.m_Shape.width, roomBuild.m_Shape.height);
        Vector3 pos       = new Vector3(-50f * size.x, 40f, -600f);
        Vector3 scaleSize = new Vector3(35f, 35f, 35f);

        dropHeroChild.transform.localPosition = pos;
        dropHeroChild.transform.localScale    = scaleSize;

        Vector3 local = Vector3.zero;
        Vector3 world = dropHeroChild.transform.TransformPoint(local);

        roomBuild.m_cx = 0;
        roomBuild.m_cy = 0;
        Building buildlife = LifeFactory.CreateBuilding(roomBuild, 0, dropHeroChild.transform, world, LifeEnvironment.View);

        if (buildlife != null)
        {
            buildlife.PlayClickAni();
        }
        // 创建房间外壳
        if (roomBuild.m_RoomType != RoomType.DeckTrap)   //非甲板房间需加壳
        {
            GenerateShip.GenerateShipBuildingShellWithouClear(dropHeroChild.transform, roomBuild.GetBuildCanvasInfo());
        }
        m_Tropies = dropHeroChild;
        SetStarsLevel(roomBuild.StarLevel);
        GameObjectLoader.SetGameObjectLayer(dropHeroChild, gameObject.layer);

        NGUIUtil.SetActive(MyHead.Building, true);
        string[] s = roomBuild.m_Desc.Split(new string[] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length > 1)
        {
            string text = string.Format("{0}{1}", NGUIUtil.GetStringByKey(88800039), s[0]);
            NGUIUtil.SetLableText(MyHead.LblBuildDesc, text);
            NGUIUtil.SetLableText(MyHead.LblBuildEffect, s[1]);
        }
    }