Ejemplo n.º 1
0
    private void FixedUpdate()
    {
        RaycastResult?result = terrainRaycast.LookingAt;

        lineRenderer.activated = result.HasValue;
        if (result.HasValue)
        {
            SetLocation(result.Value.Position);
        }
        else
        {
            return;
        }

        if (!isBreaking)
        {
            if (CrossPlatformInputManager.GetAxisRaw("Place") > 0)
            {
                Point3 p = result.Value.Position;
                terrainManager.ChangeCell(p.X, p.Y, p.Z, 0);
                StartCoroutine(Delay(0.1f));
            }
            else if (CrossPlatformInputManager.GetAxisRaw("Destroy") > 0)
            {
                Point3 p = result.Value.LastPosition;
                terrainManager.ChangeCell(p.X, p.Y, p.Z, placeBlockValue);
                //StartCoroutine (Delay (0.1f));
            }
        }
    }
Ejemplo n.º 2
0
    public void FillWith(int startx, int starty, int startz, int endx, int endy, int endz, int value)
    {
        int sizex = endx - startx;
        int sizey = endy - starty;
        int sizez = endz - startz;

        for (int x = 0; x < sizex; x++)
        {
            for (int y = 0; y < sizey; y++)
            {
                for (int z = 0; z < sizez; z++)
                {
                    terrainManager.ChangeCell(startx + x, starty + y, startz + z, value);
                }
            }
        }

        //ConsoleLog.LogFormat("filling: {0}, {1}, {2}", startx, starty, startz);

        //startx = (startx - 1) >> 4;
        //startz = (startz - 1) >> 4;
        //endx = (endx + 1) >> 4;
        //endz = (endz + 1) >> 4;
        //sizex = endx - startx;
        //sizez = endz - startz;

        //ConsoleLog.LogFormat("updating chunk: {0}, {1}", startx, startz);

        //for (int x = 0; x < sizex; x++)
        //{
        //    for (int z = 0; z < sizez; z++)
        //    {
        //        terrainManager.QuqueChunkUpdate(terrain.GetChunkIndex(startx + x, startz + z), 3);
        //    }
        //}
    }