예제 #1
0
        void OnDrawGizmos()
        {
            if (drawGizmos)
            {
                samplers         = GetSamplers();
                textureGenerator = GetComponent <GameOfLifeTextureGenerator>();
                if (samplers == null)
                {
                    Debug.Log("Sampler is null! Add a sampler to the NoiseForm");
                }
                int playerX = (int)(Mathf.Floor((player.transform.position.x) / (quadsPerTile * cellSize)) * quadsPerTile);
                int playerZ = (int)(Mathf.Floor((player.transform.position.z) / (quadsPerTile * cellSize)) * quadsPerTile);

                Gizmos.color = Color.cyan;
                int gizmoTiles = 4;
                for (int x = -gizmoTiles; x < gizmoTiles; x++)
                {
                    for (int z = -gizmoTiles; z < gizmoTiles; z++)
                    {
                        Vector3 pos = new Vector3((x * quadsPerTile + playerX),
                                                  0,
                                                  (z * quadsPerTile + playerZ));
                        pos *= cellSize;
                        pos += transform.position;
                        Mesh gm = GenerateMesh(pos);
                        Gizmos.DrawMesh(gm, pos);

                        /*for (int i = 0; i < gm.vertices.Length; i += 2)
                         * {
                         * Gizmos.DrawLine(pos + gm.vertices[i], pos + gm.vertices[i + 1]);
                         * }*/
                    }
                }
            }
        }
예제 #2
0
        // Use this for initialization
        void Start()
        {
            //this.gameObject.transform.position = Vector3.zero;
            startPos = Vector3.zero;

            textureGenerator = GetComponent <GameOfLifeTextureGenerator>();

            StartCoroutine(GenerateWorldAroundPlayer());
        }