Exemplo n.º 1
0
    public override void Awake()
    {
        base.Awake();

        space     = GameObject.Find("Space");
        houseNode = new Transform[HOUSE_NODE_CNT];
        for (int i = 0; i < HOUSE_NODE_CNT; i++)
        {
            houseNode[i] = space.transform.FindChild(string.Format("HouseNode{0}", i));
        }
        housePrefab = space.transform.FindChild("HousePrefab");
        housePrefab.gameObject.SetActive(false);

        houses = new House[HOUSE_NODE_CNT];

        m_MapGridUnityLenHalf = 0.5f * m_MapGridUnityLen;

        _click3DCheck = new Click3DCheck();

        MapUtil.Init();

        if (m_DrawGrid)
        {
#if UNITY_EDITOR
            JerryDrawer.Draw <DrawerElementGrid>()
            .SetMinPos(m_LeftSideWallStartPos + new Vector3(0.01f, 0, 0))
            .SetGridSize(Vector2.one * GameApp.Inst.m_MapGridUnityLen)
            .SetSize(SizeXYZ2XY(m_LeftSideWallSize, Enum_Wall.Left))
            .SetPlaneType(DrawerElementGrid.PlaneType.ZY)
            .SetColor(Color.red);

            JerryDrawer.Draw <DrawerElementGrid>()
            .SetMinPos(m_RightSideWallStartPos + new Vector3(-0.01f, 0, 0))
            .SetGridSize(Vector2.one * GameApp.Inst.m_MapGridUnityLen)
            .SetSize(SizeXYZ2XY(m_RightSideWallSize, Enum_Wall.Right))
            .SetPlaneType(DrawerElementGrid.PlaneType.ZY)
            .SetColor(Color.red);

            JerryDrawer.Draw <DrawerElementGrid>()
            .SetMinPos(m_WallStartPos + new Vector3(0, 0, -0.01f))
            .SetGridSize(Vector2.one * GameApp.Inst.m_MapGridUnityLen)
            .SetSize(SizeXYZ2XY(m_WallSize, Enum_Wall.Wall))
            .SetPlaneType(DrawerElementGrid.PlaneType.XY)
            .SetColor(Color.black);

            JerryDrawer.Draw <DrawerElementGrid>()
            .SetMinPos(m_FloorWallStartPos + new Vector3(0, 0.01f, 0))
            .SetGridSize(Vector2.one * GameApp.Inst.m_MapGridUnityLen)
            .SetSize(SizeXYZ2XY(m_FloorWallSize, Enum_Wall.Floor))
            .SetPlaneType(DrawerElementGrid.PlaneType.XZ)
            .SetColor(Color.black);
#endif
        }

        MeshDraw.Inst.InitConfig();

        JerryEventMgr.AddEvent(Enum_Event.Click3DObj.ToString(), EventClick3DObj);

        CreateHouse(0, 0);
    }
Exemplo n.º 2
0
    void Start()
    {
        JerryDrawer.Draw <DrawerElementPath>()
        .SetPoints(Pos1, Pos2)
        .SetColor(Color.yellow)
        .SetExecuteInEditMode(true);

        JerryDrawer.Draw <DrawerElementPath>()
        .SetPoints(Vector3.one, Vector3.zero, Vector3.left)
        .SetAddPoints(Vector3.one)
        .SetExecuteInEditMode(true);

        JerryDrawer.Draw <DrawerElementLabel>()
        .SetPos(new Vector3(1, 2, 1))
        .SetText("xxx")
        .SetColor(Color.red);

        JerryDrawer.Draw <DrawerElementCube>()
        .SetPos(new Vector3(1, 0, 1))
        .SetWire(true)
        .SetSize(Vector3.one)
        .SetSizeFactor(3)
        .SetColor(Color.green)
        .SetExecuteInEditMode(false);
    }
Exemplo n.º 3
0
    private void DrawRay(string name, Vector3 from, Vector3 dir)
    {
        DrawerElementPath p = JerryDrawer.GetElement <DrawerElementPath>(name);

        if (p == null)
        {
            p = JerryDrawer.Draw <DrawerElementPath>().SetColor(Color.red).SetID(name);
        }
        p.SetPoints(from, from + dir);
    }