private void OnTriggerEnter2D(Collider2D other) { StateReciever.SetState(States.INACTIVE); transitionCamera.GetComponent <CameraSplice>().enabled = true; particle.Play(); gameObject.SetActive(false); }
void LateUpdate() { if (particleSystem.isPlaying) { Vector3 screenPoint = Camera.main.WorldToViewportPoint(UIElement.transform.position); if (screenPoint.x > horizontalPosition - range && screenPoint.x < horizontalPosition + range) { //Camera.main.enabled = false; //newCamera.enabled = true; //this.enabled = false; StateReciever.SetState(States.ACTIVE); SceneChanger.ChangeScene("Level1"); } } }
private void FixedUpdate() { if (runInstance > runTimes) { mask.SetActive(false); image.SetActive(false); StateReciever.SetState(States.ACTIVE); this.enabled = false; return; } timeRunning++; if (timeRunning >= maxTime) { runInstance++; mask.GetComponent <RectTransform>().position = startPos; mask.GetComponent <Rigidbody2D>().velocity = Vector2.zero; timeRunning = 0; } mask.GetComponent <Rigidbody2D>().AddForce(force * Mathf.Clamp(timeRunning / 30, 0, 1) * forceMultiplierOverTime, ForceMode2D.Force); }