private void Init() { aStarGrid = GameObject.FindGameObjectWithTag("AStar").GetComponent <ASGrid>(); camController = Camera.main.GetComponent <CameraController>(); gridSpawner = GetComponent <GridSpawner>(); bonusTestManager = FindObjectOfType <BonusManager>(); gridSpawner.SetGridTransformr(transform); thisTransform = transform; camController.SetCamSize(gridSize.x, gridSize.y, cellDiameter); Action <Vector3[, ]> level1 = SetLevel1; Action <Vector3[, ]> level2 = SetLevel2; Action <Vector3[, ]> level3 = SetLevel3; levelsList = new Dictionary <int, Action <Vector3[, ]> > { { 1, level1 }, { 2, level2 }, { 3, level3 } }; }
void Start() { float spawnDelta = 1f; for (int i = 0; i < nbParticles; i++) { neighbors.Add(new List <int>()); Particle particle = new Particle(); float x = UnityEngine.Random.Range(minx + spawnDelta, maxx - spawnDelta); float y = UnityEngine.Random.Range(miny + spawnDelta, maxy - spawnDelta); particle.index = i; particle.hashKey = -1; particle.pos.x = x; particle.pos.y = y; particle.posprev.x = x; particle.posprev.y = y; particles.Add(particle); } grid = new ASGrid(); distanceField = new BakedDistanceField(distanceFieldData); sqrRadius = fluidData.radius * fluidData.radius; InitMesh(); }
private void Start() { grid = GetComponent <ASGrid>(); }