Пример #1
0
 //float g;
 //float b;
 // Use this for initialization
 void Start()
 {
     //randomImage ();
     mainCamera = GameObject.Find("Main Camera");
     playerScript = mainCamera.GetComponent<CreateBlocks>();
     StartCoroutine(WaitOneSecond());
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     hl   = GameObject.FindGameObjectWithTag("effect").GetComponent <Heallight>();
     sctu = GameObject.Find("CoinShooter").GetComponent <SootingCoinsToUI>();
     pb   = GameObject.Find("PauseButton").GetComponent <PauseButton>();
     cl   = GameObject.Find("ColForStation").GetComponent <ColforLand>();
     sb   = GameObject.Find("SaveButton").GetComponent <SaveButton>();
     ewb  = GameObject.Find("ExitWButton").GetComponent <ExitWButton>();
     cb   = GameObject.Find("MazeCreator").GetComponent <CreateBlocks>();
 }
Пример #3
0
    // assumes that InitializeBlocks has been called first
    // blocks should be in a 1D array
    public int setBlocks(NativeArray <int> blockIndices, int cx, int cy)
    {
        // set up and run noise function
        var perlin = new CalculatePerlin
        {
            heightMap   = noise,
            permutation = this.permutation,
            randomArray = this.randomArray,
            dimensions  = NoiseAlgorithm.DIMENSIONS,
            permSize    = NoiseAlgorithm.PERM_SIZE,
            width       = this.width,
            height      = this.depth,
            xOffset     = this.xOffset,
            yOffset     = this.yOffset,
            zOffset     = 0,
            positionX   = cx,
            positionZ   = cy,
            scale       = this.scale,
            octaves     = this.octaves,
            frequency   = this.frequency,
            amplitude   = this.amplitude,
            lacunarity  = this.lacunarity,
            gain        = this.gain,
        };
        var perlinJob = perlin.Schedule(width * depth, 64);

        perlinJob.Complete();

        // normalize all those values
        var normalize = new NormalizePerlin
        {
            heightMap = noise,
        };
        var normalizeJob = normalize.Schedule(width * depth, 64);

        normalizeJob.Complete();

        // make a job to set all the block indices
        var blockCreation = new CreateBlocks
        {
            width        = width,
            height       = height,
            depth        = depth,
            maxHeight    = maxHeight,
            seaLevel     = seaLevel,
            noise        = noise,
            blockIndices = blockIndices,
        };
        var blockCreationJob = blockCreation.Schedule(width * depth * height, 64);

        blockCreationJob.Complete();

        // return a summation of real (not air) blocks in the the list after
        // terrain creation
        int solidBlocks = 0;

        for (int i = 0; i < blockIndices.Length; i++)
        {
            if (blockIndices[i] != (int)BlockTypes.Air)
            {
                solidBlocks++;
            }
        }
        return(solidBlocks);
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     CB = GameObject.Find("MazeCreator").GetComponent <CreateBlocks>();
     StartCoroutine(StartLoad("Ingame"));
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     mainCamera = GameObject.Find("Main Camera");
     playerScript = mainCamera.GetComponent<CreateBlocks>();
     scr = GameObject.Find ("P1Score").GetComponent<Text>();
     txt = GetComponent<Text>();
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     CB = GameObject.Find("Main Camera").GetComponent <CreateBlocks>();
 }