コード例 #1
0
    //After collision with a falling dude, bounce the other dude and set up conditions/variables for each dude
    private void bounceDude(Collision2D col)
    {
//		ParticleSystem ps;
//		if(teeterSide == 'l'){
//			ps = Instantiate(landingPS, new Vector2(transform.position.x + .2f, transform.position.y + .1f), Quaternion.identity);
//		}else{
//			ps = Instantiate(landingPS, new Vector2(transform.position.x - .2f, transform.position.y + .1f), Quaternion.identity);
//		}
//		Destroy (ps, .4f);

        checkHit(col);          //Saw 1/2

        if (!controlScript.gameOver)
        {
            bouncerScript.setAttached('l', false);
            bouncerScript.setAttached('r', false);
            bouncerScript.setParent(null);
            bungieScript.dude = dudeOnSaw;
            dudeOnSaw         = col.gameObject;
            bouncerScript     = dudeOnSaw.GetComponent <Bouncer> ();
            bouncerScript.setParent(saw);
            bouncerScript.setTeeterCol(false);
            bouncerScript.setBalloonCol(false);
            bouncerScript.switchPlatformCollider(false);
            if (teeterSide == 'l')
            {
                bouncerScript.setAttached('l', true);
            }
            else
            {
                bouncerScript.setAttached('r', true);
            }
            source.PlayOneShot(bounceSound, .75f);              // Play the bounce sound
        }
    }