internal void Init() { GameManager gm = GameObject.Find("Manager").GetComponent <GameManager>(); platMovement = GameObject.Find("MovingObjects").GetComponent <PlatformMovement>(); platEmitter = GameObject.Find("PlatformEmitter").GetComponent <PlatformEmitter>(); fallPoint = GameObject.Find("FallPoint").GetComponent <PlatformFall>(); if (presetModel == null) { gm.SpawnPlayer(); //player = GameObject.FindGameObjectWithTag("Player"); } else { CameraColorShift.brightness = presetModel.brightness; CameraColorShift.contrast = presetModel.contrast; CameraColorShift.saturation = presetModel.saturation; CameraColorShift.hue = presetModel.hue; platEmitter.columnCount = presetModel.platStreamWidth; platEmitter.multiplePaths = presetModel.multiplePaths; platMovement.speed = presetModel.platSpeed; if (presetModel.textures == 0) { borderMat = 3; groundMat = 11; towerMat = 1; platMat = 8; } else if (presetModel.textures == 1) { borderMat = 4; groundMat = 6; towerMat = 9; platMat = 3; } else { borderMat = 2; groundMat = 7; towerMat = 8; platMat = 0; } SetMaterials(); gm.SetPlayerObject(); gm.SpawnPlayer(); } timeAlive = 0f; playerIsAlive = true; gm.trail = player.GetComponent <TrailRenderer>(); playCtrl = player.GetComponent <PlayerController>(); startJumpTime = playCtrl.jumpTime; startPlatSpeed = platMovement.speed; startFallSpeed = fallPoint.fallSpeed; startDecJumpSpeed = playCtrl.decreaseJumpBySpeed; playCtrl.decreaseJumpBySpeed = 1 + (startPlatSpeed * .02f); }
//called before start void Awake() { pf = GetComponent <PlatformFall>(); sc = GetComponent <SpawnCoins>(); //find length of longest collider sizeX = -1f; List <BoxCollider2D> colliders2d = new List <BoxCollider2D>(); GetComponents(colliders2d); foreach (BoxCollider2D c2d in colliders2d) { if (c2d.size.x > sizeX) { sizeX = c2d.size.x; } } }