Beispiel #1
0
    void CalcCollision()
    {
        if (sIsInvincible)
        {
            return;
        }

        if (mCollisionManager.CheckSphereCollision(transform.position, 0.1f) ||
            (mCourseManager.CheckInsideCoursePart(transform.position) < 0) ||
            (mTimeLeft <= 0.0f))
        {
            mIsDestroyed = true;
            Destroy(GetComponent <SpriteRenderer> ());
            mAudioSourceDestroy.PlayOneShot(mAudioSourceDestroy.clip);
            iTween.ShakePosition(GameObject.FindWithTag("MainCamera"), iTween.Hash("x", 0.3f, "y", 0.3f, "time", 0.2f));
            mParticleSystemCrushSmoke.transform.position = transform.position;
            mParticleSystemCrushSmoke.GetComponent <ParticleSystem> ().Play();
            mParticleSystemSmokeLeft.GetComponent <ParticleSystem> ().Stop();
            mParticleSystemSmokeRight.GetComponent <ParticleSystem> ().Stop();

            if (!mIsGoal)
            {
                mGameOverManager.GameOver(false, mCoursePartIndex, mStar, mTimeLeft);
                mStarManager.OnGameOver();
            }
        }

        if (mStarManager.CheckSphereCollision(transform.position, 0.1f))
        {
            ++mStar;
        }
    }