PlayShake() 공개 메소드

public PlayShake ( ) : void
리턴 void
예제 #1
0
 public void GetHit()
 {
     if (dead)
     {
         return;
     }
     screenShaker.PlayShake();
     FadingView.instance.FlashBloodView();
 }
예제 #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         int damage = collision.gameObject.GetComponent <IDamageTaker>().Health;
         TakeDamage(damage);
         collision.gameObject.GetComponent <IDamageTaker>().TakeDamage(damage);
         shake.PlayShake();
     }
 }
예제 #3
0
    IEnumerator StartBloodEffect()
    {
        BloodImage.gameObject.SetActive(true);
        Shaker.PlayShake();
        //fade out
        for (float timer = 1; timer >= 0; timer -= Time.deltaTime * 5)
        {
            BloodImage.color = new Color(BloodImage.color.r, BloodImage.color.g, BloodImage.color.b, timer);
            yield return(null);
        }

        yield break;
    }
예제 #4
0
    void OnCollisionEnter2D(Collision2D col)
    {
        GameObject collisionObject = col.gameObject;

        // Block Collision
        if (collisionObject.tag == "Block")
        {
            Destroy(Instantiate(collisionWithBlockEffect.gameObject, col.contacts[0].point, Quaternion.FromToRotation(Vector3.forward, col.contacts[0].normal)) as GameObject, collisionWithBlockEffect.startLifetime);
            Block block = collisionObject.GetComponent <Block>();
            block.Hit();
        }

        // Wall Collision
        else if (collisionObject.tag == "Wall")
        {
            shake.PlayShake();
        }

        // Lose life / Die
        else if (collisionObject.tag == "Floor")
        {
            ScoreManager.lives--;

            Destroy(Instantiate(deathEffect.gameObject, col.contacts[0].point, Quaternion.FromToRotation(Vector3.forward, col.contacts[0].normal)) as GameObject, deathEffect.startLifetime);
            Destroy(Instantiate(deathWallEffect.gameObject, new Vector3(0, -5f, 0), deathWallEffect.gameObject.transform.rotation) as GameObject, deathWallEffect.startLifetime);

            GetComponent <Flash>().StartFlash();

            if (ScoreManager.lives < 0)
            {
                ScoreManager.GameOver();
                rb.velocity = new Vector2(0, 0);
                GetComponent <Renderer>().enabled         = false;
                GetComponent <CircleCollider2D>().enabled = false;
            }
            else
            {
                rb.velocity = new Vector2(0, 0);
                GetComponent <Renderer>().enabled         = false;
                GetComponent <CircleCollider2D>().enabled = false;
                dead = true;
            }
        }

        // Collision particle dust and sound effect
        Destroy(Instantiate(collisionEffect.gameObject, col.contacts[0].point, Quaternion.FromToRotation(Vector3.forward, col.contacts[0].normal)) as GameObject, collisionEffect.startLifetime);
        source.PlayOneShot(shootSound, Random.Range(minVol, maxVol));
    }
예제 #5
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "hazard")
        {
            perlinshake.PlayShake();
            Destroy(Instantiate(zombieDeath, this.transform.position, Quaternion.identity), zombieDeath.startLifetime);
            Destroy(this.gameObject);
            UIFunction.addOne();
        }

        if (other.gameObject.tag == "House")
        {
            Destroy(this.gameObject);
            UIFunction.minusOne();
        }
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("Game information: " + gameObject.name + " on enter triggered " + other.gameObject.name);
        switch (other.gameObject.tag)
        {
        case "Feather":
            featherCount++;
            Destroy(other.gameObject.transform.parent.gameObject);
            break;

        case "Bullet":
            break;

        case "End":
            //Application.LoadLevel(0);
            StartCoroutine(NextLevel());
            break;

        default:
            PerlinShake shaker = Camera.main.GetComponent <PerlinShake>();
            shaker.PlayShake();
            break;
        }
    }