Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log ("door "+ name);


        if (other.gameObject.name != "hero")
        {
            return;
        }

        // First, pause the game and start a fade out
        GameMain gm = Camera.main.GetComponent("GameMain") as GameMain;

        AudioSource.PlayClipAtPoint(gm.SFXDoor, Camera.main.transform.position);

        FadeOut fo = Camera.main.GetComponent("FadeOut") as FadeOut;

        fo.DoFadeOut(5, endFadeOut);
        RoomManager.Instance.Pause = true;
    }
Beispiel #2
0
    public void ChangeDirection(ChangeSceneButtom.Direction dir)
    {
        GameObject currScene = FindSceneByIndex(mCurrSceneI, mCurrSceneJ);

        switch (dir)
        {
        case ChangeSceneButtom.Direction.UP:
            mCurrSceneJ += 1;
            break;

        case ChangeSceneButtom.Direction.DOWN:
            mCurrSceneJ -= 1;
            break;

        case ChangeSceneButtom.Direction.LEFT:
            mCurrSceneI -= 1;
            break;

        case ChangeSceneButtom.Direction.RIGHT:
            mCurrSceneI += 1;
            break;

        default:
            Debug.LogError("Unkown direction");
            break;
        }
        fadeOutUtil.DoFadeOut();
        GameObject newScene = FindSceneByIndex(mCurrSceneI, mCurrSceneJ);

        newScene.SetActive(true);
        currScene.SetActive(false);
        Vector3 move = newScene.transform.position - currScene.transform.position;

        this.transform.position += move;
        foreach (GameObject ui in UIobjs)
        {
            ui.transform.position += move;
        }
    }