// ================================================================ // Initialize // ================================================================ public void Initialize (Transform _parentTransform, BGDials _bgDialsRef, CameraController _cameraControllerRef) { bgDialsRef = _bgDialsRef; cameraControllerRef = _cameraControllerRef; this.transform.SetParent (_parentTransform); spriteRenderer = GetComponent<SpriteRenderer> (); // Just gimmie some defaults for shiggles. lifetimeDuration = 5 * bgDialsRef.LifetimeScale;// * lifetimeDurationOnSpawnScale; vel = Vector3.zero; // spriteAlphaVel = 0; diameterVel = 0; rotationVel = 0; parallaxScale = 0; baseColor = Color.white; spriteRenderer.color = baseColor; GameUtils.SizeSprite (spriteRenderer, diameter,diameter); // Spawn and prewarm! Spawn (); timeAlive = Random.Range (0, lifetimeDuration); // Add event listeners! // GameManagers.Instance.EventManager.CameraPosChangedEvent += OnCameraPosChanged; // GameManagers.Instance.EventManager.CameraViewSectorChangedEvent += OnCameraViewSectorChanged; // GameManagers.Instance.EventManager.CameraZoomChangedEvent += OnCameraZoomChanged; }
// ================================================================ // Initialize // ================================================================ void Start () { // Identify components! bgDials = GetComponent<BGDials> (); // Default background to look like dis! particlesSwirl.SetNumParticles (20); particlesEddyGlitter.SetNumParticles (120); // Add event listeners! // GameManagers.Instance.EventManager.GameControllerSetCurrentLevelEvent += OnGameControllerSetCurrentLevel; }