Exemplo n.º 1
0
    bool RevisePosition()
    {
        if (!mRevisePosition)
        {
            return(true);
        }

        Vector3 position = transform.position;

        RaycastHit hitInfo;

        if (AiUtil.CheckPositionOnGround(position,
                                         out hitInfo,
                                         256.0f,
                                         256.0f,
                                         AiUtil.groundedLayer))
        {
            transform.position = hitInfo.point;
            if (!mErode || AIErodeMap.IsInErodeArea(transform.position) == null)
            {
                return(true);
            }
        }

        return(false);
    }
Exemplo n.º 2
0
    void LoadNoiseBossPoints(IntVector4 node)
    {
        int nx = node.x >> VoxelTerrainConstants._shift >> node.w;
        int nz = node.z >> VoxelTerrainConstants._shift >> node.w;

        float value = (float)mNoise.Noise(nx, nz);

        if (value < -0.5f)
        {
            int length = VoxelTerrainConstants._numVoxelsPerAxis << node.w;

            float ox = (float)mNoise.Noise(nx, nz, nx + nz) * 0.5f + 0.5f;
            float oz = (float)mNoise.Noise(nz, nx, nx - nz) * 0.5f + 0.5f;

            Vector3 pos = new Vector3(node.x + ox * length, node.y, node.z + oz * length);

            if (AIErodeMap.IsInErodeArea(pos) == null)
            {
                Quaternion rot   = Quaternion.Euler(0.0f, Random.Range(0, 360), 0.0f);
                SPPoint    point = SPPoint.InstantiateSPPoint <SPPointBoss>(pos, rot, nextIndex, transform, 0, 0, true, true, true, true, true, mNoise);
                point.name = "Noise boss : " + point.name;
                RegisterSPPoint(point);
            }

            //Debug.LogError("Noise boss ai point : " + pos);
        }
    }
Exemplo n.º 3
0
    protected virtual bool RevisePosition(IntVector4 node)
    {
        if (!mRevisePosition)
        {
            return(true);
        }

        Vector3 position = new Vector3(transform.position.x, node.y, transform.position.z);

        RaycastHit hitInfo;

        if (AiUtil.CheckPositionOnGround(position, out hitInfo, 0.0f,
                                         VoxelTerrainConstants._numVoxelsPerAxis << node.w,
                                         AiUtil.groundedLayer))
        {
            transform.position = hitInfo.point;
            if (!mErode || AIErodeMap.IsInErodeArea(transform.position) == null)
            {
                return(true);
            }
        }

        return(false);
    }