コード例 #1
0
ファイル: MapSystem.cs プロジェクト: jabackf/Blubber2
    //map can either be a map name (in the format of mapname_xpos_ypos)
    //or one of the special keywords: left, right, up, down, current
    //Reload = rather to reload the scene if the specified map is the map that is already loaded
    //Returns true on success, false if scene change was rejected
    public bool goTo(string map, transitions trans = transitions.DEFAULT, bool reload = true)
    {
        if (transitioning)
        {
            return(false);
        }

        if (reload == false && currentMap == map)
        {
            return(false);
        }

        if (trans != transitions.DEFAULT)
        {
            transition = trans;
        }
        string transitionString = getNewMapString(map);

        nextMap = transitionString;

        GameObject p = GameObject.FindWithTag("Player") as GameObject;

        p.GetComponent <CharacterController2D>().sceneChangeStart(map);

        startTransition(transitionString);

        global.sceneChanging = true;

        return(true);
    }
コード例 #2
0
    public void Transition(transitions t, int time)
    {
        switch (t)
        {
        case transitions.FadeIn:

            break;

        case transitions.FadeOut:

            break;
        }
    }
コード例 #3
0
    public void ChangeBackground(string s, transitions t, int time)
    {
        Sprite newBackground = Resources.Load <Sprite>("Backgrounds/" + s);

        if ((newBackground) == null && s.ToUpper() != "BLACK")
        {
            newBackground = Resources.Load <Sprite>("Backgrounds/NoTexture");
        }
        if (ActiveBackground.GetComponent <SpriteRenderer>().sprite != null)
        {
            InactiveBackground.GetComponent <SpriteRenderer>().sprite = ActiveBackground.GetComponent <SpriteRenderer>().sprite;
        }
        InactiveBackground.GetComponent <SpriteRenderer>().sprite = ActiveBackground.GetComponent <SpriteRenderer>().sprite;
        ActiveBackground.GetComponent <SpriteRenderer>().sprite   = newBackground;
        ActiveBackground.GetComponent <Background>().AutoSize();
        InactiveBackground.GetComponent <Background>().AutoSize();
        Transition(t, time);
    }
コード例 #4
0
    public void Transition(transitions t)
    {
        switch (t)
        {
        case transitions.Fade:
            ActiveBackground.GetComponent <Background>().MakeTransparent();
            InactiveBackground.GetComponent <Background>().MakeOpaque();
            ActiveBackground.GetComponent <Background>().FadeInInit(1f);
            InactiveBackground.GetComponent <Background>().FadeOutInit(1f);
            break;

        case transitions.FadeToBlack:
            InactiveBackground.GetComponent <SpriteRenderer>().sprite = ActiveBackground.GetComponent <SpriteRenderer>().sprite;
            ActiveBackground.GetComponent <SpriteRenderer>().sprite   = null;
            InactiveBackground.GetComponent <Background>().MakeOpaque();
            InactiveBackground.GetComponent <Background>().FadeOutInit(1f);
            //ActiveBackground.GetComponent<SpriteRenderer>().sprite = null;
            break;
        }
    }