Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         m_shakeable.InduceStress(3);
     }
 }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if ((collision.gameObject.tag == "Player_rb") && (Player_Move.time > 2))
        {
            Debug.Log("114514");
            Player_rb.off = true;
        }

        if (sound_on == false)
        {
            if (collision.tag == "Player")
            {
                if (Player_Move.break_stop == false)
                {
                    var damageParticle = GameObject.Instantiate(damagePrefab, collision.transform.position, Quaternion.identity) as GameObject;
                    m_shakeable.InduceStress(1);
                    // 全体のタイムスケールを変更する
                    timeManager.SlowDown();

                    //shake.Shake(1.25f, 2.1f);
                    MainSpriteRenderer.sprite = After;
                    sound_on = true;
                    if (Sound_stop == false)
                    {
                        audioSource.Play();
                    }
                    Destroy(this.gameObject.GetComponent <BoxCollider2D>());
                    //Destroy(this.gameObject.GetComponent<BoxCollider2D>());
                    this.gameObject.AddComponent <PolygonCollider2D>();
                    this.gameObject.tag = "Break";
                    Player_Move.hit++;
                }
            }
        }
    }
Esempio n. 3
0
    private IEnumerator Start()
    {
        yield return(new WaitForSeconds(delay));

        GetComponent <ParticleSystem>().Play();

        //根据离摄像机距离 调节压力系数
        float distance   = Vector3.Distance(transform.position, target.transform.position);
        float distance01 = Mathf.Clamp01(distance / range);

        float stress = (1 - Mathf.Pow(distance01, 2)) * maximumStress;

        target.InduceStress(stress);
    }
Esempio n. 4
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            PlayerController playerController = other.gameObject.GetComponent <PlayerController>();
            playerController.jumpMultiplier *= jumpMultiplier;

            audioSource.PlayOneShot(jumperZoneClips[Random.Range(0, jumperZoneClips.Length)]);

            cameraShake.ResetToDefault();
            // cameraShake.recoverySpeed = 0.1f;
            cameraShake.frequency      = 25.0f;
            cameraShake.traumaExponent = 0.8f;
            cameraShake?.InduceStress(0.01f);
        }
    }
Esempio n. 5
0
    void StartFightVFX(GameObject touchingChaser)
    {
        GameObject shakeGameobject = GameObject.FindGameObjectWithTag("CameraShake");

        cameraShake = shakeGameobject?.GetComponent <ShakeableTransform>();
        if (fightVFX != null && !fightVFX.isPlaying)
        {
            fightVFX.Play();
            cameraShake.ResetToDefault();
            cameraShake.maximumAngularShake = new Vector3(15, 15, 15);
            cameraShake.recoverySpeed       = 0.3f;
            cameraShake.frequency           = 5.0f;
            cameraShake.traumaExponent      = 1.53f;
            cameraShake.InduceStress(0.3f);
        }
    }
    private IEnumerator Start()
    {
        yield return(new WaitForSeconds(delay));

        GetComponent <ParticleSystem>().Play();

        float distance = Vector3.Distance(transform.position, target.transform.position);

        // Retrieve a value in the 0...1 range, where it is 0 when
        // the target is immediately beside us, and 1 when at (or beyond) maximum range.
        float distance01 = Mathf.Clamp01(distance / range);

        // Square the value to create a parabolic falloff curve,
        // then invert it such that closer distances cause greater stress.
        // https://en.wikipedia.org/wiki/Parabola
        float stress = (1 - Mathf.Pow(distance01, 2)) * maximumStress;

        target.InduceStress(stress);
    }
Esempio n. 7
0
 public void AddStress(float stress)
 {
     cameraShake.InduceStress(stress);
 }