Пример #1
0
 public void UpdateBlocks()
 {
     foreach (var block in battleBlocks)
     {
         var isBake = m_CoordDataSet.GetCoordValue(block.BattlePos.X, block.BattlePos.Y) == 1;
         block.gameObject.GetComponent <EasyDecal>().Baked = isBake;
     }
 }
Пример #2
0
    private void DrawMovezones(Vector3 center, int range = -1)
    {
        if (range == -1)
        {
            range = m_MovezoneDrawRange;
        }
        ClearAllBlocks();
        var tempXY  = m_CoordDataSet.GetXYIndex(center.x, center.z);
        var centerX = (int)tempXY.X;
        var centerY = (int)tempXY.Y;

        for (int i = centerX - range; i < centerX + range; i++)
        {
            if (i < 0 || i >= m_CoordDataSet.CountX)
            {
                continue;
            }
            for (int j = centerY - range; j < centerY + range; j++)
            {
                if (j < 0 || j >= m_CoordDataSet.CountY)
                {
                    continue;
                }

                var        tempPos = m_CoordDataSet.CalcPos(i, j);
                var        pos     = new Vector3(tempPos.X, 10.0f, tempPos.Y);
                var        ray     = new Ray(pos, Vector3.down);
                RaycastHit hitInfo;
                //用射线穿透地表,求地上的那个点
                if (Physics.Raycast(ray, out hitInfo, 100f, 1 << LayerMask.NameToLayer("Ground")))
                {
                    //无效格子不显示
                    if (m_CoordDataSet.GetCoordValue(i, j) == 1)
                    {
                        DrawBattleBlock(hitInfo.point, Color.green, i, j);
                    }
                }
            }
        }
    }