コード例 #1
0
ファイル: SpawnManager.cs プロジェクト: Zulban/viroid
    private void addFrequencyEvent(WaveData waveData)
    {
        //no shower, use collision timing safeguards, potentially different directions
        for (int i=0; i<waveData.frequency.count; i++) {
            BlobData blobData = worldManager.getBlobDataFromPrefab (waveData.blobPrefab);

            applyWaveData (blobData, waveData, i);

            float deltaTime = waveData.getDeltaTimeFromIndex (i);
            float spawnTime = waveData.getStartTime () + deltaTime;
            addSpawnEvent (blobData, spawnTime, true);
        }
    }
コード例 #2
0
ファイル: SpawnManager.cs プロジェクト: Zulban/viroid
    private void addShowerEvent(WaveData waveData)
    {
        //shower, ignore collision timing safeguards, same direction

        //gen direction and size to use on all shower blobs
        BlobData showerBlobData = worldManager.getBlobDataFromPrefab (waveData.blobPrefab);
        applyWaveData (showerBlobData, waveData, 0);

        int[,,] mainMapData = worldManager.getMainBlob ().getMapData ();
        IntVector3 direction=showerBlobData.getMoveDirectionUnitVector();
        IntVector2 areaSize = MDCollision.getCollisionArraySize (mainMapData, direction);
        IntVector2 cellSize = MDCollision.getCollisionArraySize (showerBlobData.getSizeVector(), direction);

        //Debug.Log ("cellsize: "+ZTools.toString(cellSize));

        int count=waveData.frequency.count;
        int spacing=waveData.frequency.showerSpacing;
        ArrayList points = ZTools.getGridSquares (areaSize, cellSize, count,spacing);
        ZTools.shuffleArraylist(points);

        int iterIndex = -1;
        foreach (IntVector2 point in points) {
            iterIndex++;

            BlobData blobData = worldManager.getBlobDataFromPrefab (waveData.blobPrefab);

            blobData.setMoveDirection (showerBlobData.getMoveDirection ());
            blobData.size = showerBlobData.size;
            blobData.setOffset (point);
            blobData.offset.guarenteeHit=false;

            float deltaTime = waveData.getDeltaTimeFromIndex (iterIndex);
            float spawnTime = waveData.getStartTime () + deltaTime;
            addSpawnEvent (blobData, spawnTime, false);
        }
    }