Пример #1
0
        public void Terminate()
        {
            BgmPlayer.Stop();
            SEPlayer.PlayOneShot(DoolAudioClip);

            DefaultCamera.gameObject.SetActive(false);
            Shakable.gameObject.SetActive(true);
            Shakable.Shake(CameraShakeDuration, CameraShakeMagnitude);

            EnemySpawner1.gameObject.SetActive(false);
            EnemySpawner2.gameObject.SetActive(false);
            EnemySpawner3.gameObject.SetActive(false);

            Movable.enabled = false;
            var dollPosition = Doll.position;

            dollPosition.y = DollYPosition;
            if (GameCache.Scores[PotInfo] > GameCache.Scores[RougeInfo])
            {
                dollPosition.x = Rouge.position.x;
                Rouge.gameObject.SetActive(false);
            }
            else
            {
                dollPosition.x = Pot.position.x;
                Pot.gameObject.SetActive(false);
            }
            Doll.position = dollPosition;

            StartCoroutine(SceneChangeCoroutine());
        }
Пример #2
0
        private void Update()
        {
            TimeElapsed += Time.deltaTime;

            if (TimeElapsed <= TransitionTime)
            {
                RectTransform.localScale = Lerp(InitialScale, TargetScale, TimeElapsed / TransitionTime);

                var color = BackgroundImage.color;
                color.a = TimeElapsed / TransitionTime;
                BackgroundImage.color = color;

                color      = Text.color;
                color.a    = TimeElapsed / TransitionTime;
                Text.color = color;
            }
            else if (TimeElapsed <= TransitionTime + Duration)
            {
            }
            else if (TimeElapsed <= TransitionTime + Duration + TransitionTime)
            {
                if (!disappearSEPlayed)
                {
                    SEPlayer.PlayOneShot(DisappearAudioClip, VolumeScale);
                    disappearSEPlayed = true;
                }

                var t = (TimeElapsed - TransitionTime - Duration) / TransitionTime;
                RectTransform.position += new Vector3(0f, FloatingSpeed * Time.deltaTime, 0f);

                var color = BackgroundImage.color;
                color.a = 1f - t;
                BackgroundImage.color = color;

                color      = Text.color;
                color.a    = 1f - t;
                Text.color = color;
            }
            else
            {
                BackgroundImage.gameObject.SetActive(false);
                gameObject.SetActive(false);
            }
        }
Пример #3
0
        private void Update()
        {
            m_RemainingShotCoolTime -= Time.deltaTime;
            if (m_RemainingShotCoolTime > 0f)
            {
                return;
            }
            else
            {
                m_RemainingShotCoolTime = 0f;
            }

            if (Input.GetKeyUp(PlayerInfo.KeyConfig.ShotKey))
            {
                SEPlayer.PlayOneShot(AudioClip1, VolumeScale1);
                SEPlayer.PlayOneShot(AudioClip2, Mathf.Lerp(MinVolumeScale2, MaxVolumeScale2, m_ChargedTime / MaxChargeTime));

                var obj = Instantiate(CannonBall);
                obj.transform.position = transform.position;
                obj.GetComponent <Rigidbody2D>().mass = Mathf.Lerp(MinMass, MaxMass, m_ChargedTime / MaxChargeTime);
                obj.GetComponent <Rigidbody2D>().AddForce(Lerp(ShotForce, MaxShotForce, m_ChargedTime / MaxChargeTime));
                obj.transform.parent = CannonBallsRoot;

                var scale = Mathf.Lerp(1f, MaxScaleMag, m_ChargedTime / MaxChargeTime);
                obj.transform.localScale *= scale;

                m_RemainingShotCoolTime = ShotCoolTime;
                m_ChargedTime           = 0f;
                return;
            }

            if (Input.GetKey(PlayerInfo.KeyConfig.ShotKey))
            {
                m_ChargedTime += Time.deltaTime;
            }
        }
Пример #4
0
        private void OnEnable()
        {
            disappearSEPlayed = false;
            SEPlayer.PlayOneShot(AppearAudioClip, VolumeScale);

            TimeElapsed     = 0f;
            InitialScale    = RectTransform.localScale;
            InitialPosition = RectTransform.position;

            switch (PopType)
            {
            case POP_TYPE.Normal:
                if (Flipped)
                {
                    BackgroundImage = FlippedNormalBackground;
                }
                else
                {
                    BackgroundImage = NormalBackground;
                }
                break;

            case POP_TYPE.Surprized:
                if (Flipped)
                {
                    BackgroundImage = FlippedSurprisedBackground;
                }
                else
                {
                    BackgroundImage = SurprisedBackground;
                }
                break;
            }

            BackgroundImage.gameObject.SetActive(true);
        }