Exemplo n.º 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log(collision.gameObject.tag);
        if (collision.gameObject.tag == "Ground" ||
            collision.gameObject.tag == "Thomas" ||
            collision.gameObject.tag == "John" ||
            collision.gameObject.tag == "Claire")
        {
            IsGround = true;
        }
        if (collision.gameObject.tag == "Teleport")
        {
            currentPlayer.transform.position = collision.transform.GetChild(0).position;
        }
        Debug.Log(collision.gameObject.tag);
        if (collision.gameObject.tag == "RedButton" && currentPlayer.tag == "Thomas")
        {
            Destroy(collision.gameObject);
            door.Move();
        }
        if (collision.gameObject.tag == "Bomb")
        {
            Destroy(collision.gameObject);
            Destroy(d);
        }
        if (collision.gameObject.tag == "BlueButton" && currentPlayer.tag == "Claire")
        {
            Destroy(collision.gameObject);
            //SpriteRenderer color = GameObject.Find("GroundChange").GetComponent<SpriteRenderer>();
            //newcolor = new Color(0f, 38f, 62f, 94f);
            //color.color = newcolor;
            //GameObject claireground = GameObject.Find("GroundChange").gameObject;
            //DisableChild(claireground);
            var ground = GameObject.Find("GroundChange").gameObject;
            ground.SetActive(false);
            d.transform.position = ground.transform.position;
            d.SetActive(true);
            //cr.isKinematic = false;

            var g = d.GetComponent <BoxCollider2D>();
            g.isTrigger = false;
        }
        if (collision.gameObject.tag == "Bullet" && currentPlayer.tag == "Thomas")
        {
            cam.isAlive = false;
            Debug.Log(collision.gameObject.tag);
            //currentPlayer.SetActive(false);
        }

        //if (collision.gameObject.tag == "Trap")
        //{
        //    Debug.Log(collision.gameObject.tag);
        //}
    }
Exemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log(other.tag);
     dm.Move();
 }