Esempio n. 1
0
    public bool ExploreCellsFast(VInt3 location, int surfSightRange, GameFowManager pFowMgr, FieldObj inFieldObj, COM_PLAYERCAMP camp, bool bStaticExplore, bool bDistOnly)
    {
        if (pFowMgr == null || inFieldObj == null)
        {
            return(false);
        }
        VInt2 vInt = VInt2.zero;

        pFowMgr.WorldPosToGrid(location, out vInt.x, out vInt.y);
        FieldObj.SViewBlockAttr sViewBlockAttr = default(FieldObj.SViewBlockAttr);
        if (inFieldObj.QueryAttr(vInt, out sViewBlockAttr) && sViewBlockAttr.BlockType == 2)
        {
            VInt2 zero = VInt2.zero;
            if (inFieldObj.FindNearestGrid(vInt, location, FieldObj.EViewBlockType.Brick, true, 3, null, out zero))
            {
                vInt = zero;
            }
        }
        if (bStaticExplore)
        {
            FowLos.TraverseStaticSurCell(surfSightRange, vInt.x, vInt.y, inFieldObj.NumX, inFieldObj.NumY, camp);
        }
        else
        {
            FowLos.TraverseSurCell(surfSightRange, vInt.x, vInt.y, inFieldObj.NumX, inFieldObj.NumY, camp, bDistOnly);
        }
        return(true);
    }
Esempio n. 2
0
        public static bool CheckGrassAttaching(ref VInt3 newPos)
        {
            FieldObj pFieldObj = Singleton <GameFowManager> .instance.m_pFieldObj;
            VInt3    vInt      = new VInt3(newPos.x, newPos.z, 0);
            VInt2    zero      = VInt2.zero;

            pFieldObj.LevelGrid.WorldPosToGrid(vInt, out zero.x, out zero.y);
            FieldObj.SViewBlockAttr sViewBlockAttr = default(FieldObj.SViewBlockAttr);
            pFieldObj.QueryAttr(zero, out sViewBlockAttr);
            if (sViewBlockAttr.BlockType == 0 && pFieldObj.FindNearestGrid(zero, vInt, FieldObj.EViewBlockType.Grass, false, 1, null, out zero))
            {
                pFieldObj.LevelGrid.GridToWorldPos(zero.x, zero.y, out vInt);
                int num = MonoSingleton <GlobalConfig> .instance.GrassEyeAbsorbDist;
                num += pFieldObj.PaneX / 2;
                if (vInt.x + num > newPos.x && vInt.x - num < newPos.x && vInt.y + num > newPos.z && vInt.y - num < newPos.z)
                {
                    newPos = new VInt3(vInt.x, newPos.y, vInt.y);
                    return(true);
                }
            }
            return(false);
        }