示例#1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        GetComponent <SpriteRenderer>().sprite = catched;
        gmScript.checkpoint = transform.position;
        gmScript.addPoint(500 * gmScript.life);
        gmScript.collisionObjects++;

        other.GetComponent <BouncyBehaviourScript>().checkpointSprite = other.GetComponent <SpriteRenderer>().sprite;
        GetComponent <Collider2D>().enabled = false;
    }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (isEnable)
     {
         GetComponent <AudioSource>().clip = ringSoundEffect;
         GetComponent <AudioSource>().Play();
         gameManScript.ringsLeft--;
         gameManScript.ringsUI[gameManScript.ringsLeft].gameObject.SetActive(false);
         gameManScript.addPoint(500 * gameManScript.life);
     }
     isEnable = false;
     this.GetComponent <SpriteRenderer>().sprite = rTop;
     this.gameObject.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = rBot;
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Life"))
        {
            playSound(collectableSoundEffect);
            other.gameObject.SetActive(false);
            gmScript.addPoint(1000 * gmScript.life);
            gmScript.life++;
            gmScript.collisionObjects++;
        }

        if (other.gameObject.tag == "checkpoint")
        {
            playSound(collectableSoundEffect);
        }
    }