コード例 #1
0
    //private void OnTriggerStay2D(Collider2D collision)
    //{
    //    if (collider.gameObject.name == "Mattress") {
    //        if (bodyMoving) {
    //            AddWobble.bedSounds = true;
    //        }
    //    }
    //}

    //private void OnTriggerExit2D(Collider2D collision)
    //{
    //    if (collider.gameObject.name == "Mattress")
    //    {
    //        if (bodyMoving)
    //        {
    //            AddWobble.bedSounds = false;
    //        }
    //    }
    //}

    // Start is called before the first frame update
    void Start()
    {
        crumple    = GameObject.Find("Crumple").GetComponent <AudioSource>();
        dragging   = false;
        collider   = GetComponent <PolygonCollider2D>();
        rigidBody  = GetComponent <Rigidbody2D>();
        renderer   = GetComponent <SpriteRenderer>();
        startColor = renderer.color;
        myWeight   = rigidBody.mass;
        curStage   = InteractionStage.TitleScreen;
        bodyMoving = false;
    }
コード例 #2
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.name == "BlindString" && !BlindShadowScript.blindsHaveBeenOpened)
        {
            print("here");
            GameObject BShadow = GameObject.Find("BlindShadow");
            BShadow.GetComponent <BlindShadowScript>().hideMyself = true;
            curStage = InteractionStage.EverythingElse;
            StartCoroutine(GameObject.Find("LightGradient").GetComponent <LightGradient>().FadeOutGradient(0.33f));
        }

        if (collision.gameObject.name == "Glass" || collision.gameObject.name == "Book")
        {
            collision.gameObject.layer = 11;
        }
    }