Example #1
0
        public override int execute(params string[] args)
        {
            bool   saveData = false;
            string jumpRoom = "";

            jumpRoom = args [1];
            if (args.Length > 2)
            {
                saveData = args [2] == "-s";
            }

            try
            {
                if (saveData)
                {
                    SceneStateManager.GetInstance().TransitionTo(jumpRoom);
                    Console.println("Transitioned to " + jumpRoom, Console.Tag.info);
                }
                else
                {
                    SceneStateManager.GetInstance().JumpTo(jumpRoom);
                    Console.println("Jumped to " + jumpRoom, Console.Tag.info);
                }
            }
                        #pragma warning disable 0168
            catch (System.ArgumentException ae)
                        #pragma warning restore 0168
            {
                Console.println("The scene " + jumpRoom + " is invalid.", Console.Tag.error);
                return(Console.EXEC_FAILURE);
            }

            Console.println("Successfully jumped to " + jumpRoom + "!");
            return(Console.EXEC_SUCCESS);
        }
Example #2
0
    // Tells the SSM that a RO has been destroyed through gameplay
    private void SaveDestruction()
    {
        if (prefabPath != "")
        {
            return;
        }

        SeedCollection seed = Reap();

        seed.destroyed = true;

        SceneStateManager.GetInstance().Store(RID, seed);
    }
Example #3
0
    public void transition()
    {
        Scene  curr     = SceneManager.GetActiveScene();
        string nextRoom = "";

        if (curr.name.Equals("test1"))
        {
            nextRoom = "test2";
        }
        else if (curr.name.Equals("test2"))
        {
            nextRoom = "test1";
        }

        SceneStateManager.GetInstance().TransitionTo(nextRoom);
    }
Example #4
0
    public void Update()
    {
        if (Input.anyKeyDown && active)
        {
            if (nextMenu != null)
            {
                MenuManager.menusys.ShowMenu(nextMenu);
            }
            else
            {
                SceneStateManager.GetInstance().JumpTo("test1");
            }

            active = false;
        }
    }
Example #5
0
    // Loads the values in a save into the GameManager for resuming a game
    public void loadGame(Save save)
    {
        saveName    = save.saveName;
        gameName    = save.gameName;
        sceneTime   = save.sceneTime;
        totalTime   = save.gameTime;
        currScene   = save.currScene;
        prevScene   = save.prevScene;
        _difficulty = save.difficulty;

        playerData = save.playerData;

        _damageTypeUnlocks = save.dtUnlocks;
        _abilities         = save.abilities;

        loadData(saveName);

        playerSpawnType = SPAWN_AT_SVPNT;
        SceneStateManager.GetInstance().JumpTo(save.currScene);
    }
Example #6
0
    public void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        SceneStateManager.GetInstance().IgnoreCurrentScene();

        paused    = false;
        pauseLock = false;

        saveName    = "";
        gameName    = "";
        sceneTime   = 0f;
        totalTime   = 0.0;
        currScene   = "";
        prevScene   = "";
        _difficulty = Difficulty.easy;

        _player         = null;
        playerData      = null;
        playerSpawnType = 0;

        _damageTypeUnlocks = 0;
        unlockDT(DamageType.PHYSICAL);

        _abilities = 0;

        saveDirectory = Application.persistentDataPath + Path.DirectorySeparatorChar
                        + "saves" + Path.DirectorySeparatorChar;
        dataDirectory = Application.persistentDataPath + Path.DirectorySeparatorChar
                        + "data" + Path.DirectorySeparatorChar;
    }
Example #7
0
    public void Update()
    {
        if (target == null)
        {
            return;
        }

        if (turning)
        {
            //turn align with "door"
            Vector3 finalDir   = transform.up;
            Vector3 currentDir = target.transform.up;

            float dp      = Vector3.Dot(finalDir, currentDir);
            float a       = dp / (finalDir.magnitude * currentDir.magnitude);
            float angleTo = Mathf.Rad2Deg * Mathf.Acos(a);

            if (angleTo > 5f)
            {
                target.transform.rotation = Quaternion.Lerp(target.transform.rotation, transform.rotation, Time.deltaTime * 3f);
            }
            else
            {
                turning = false;
            }
        }
        else
        {
            //accelerate off screen, triggering a transition when fully off screen
            target.GetComponent <Rigidbody2D> ().AddForce(target.transform.up * 2f, ForceMode2D.Impulse);

            Vector2 screenPos = Camera.main.WorldToScreenPoint(target.transform.position);
            if (screenPos.x > Screen.width + borderPadding || screenPos.x < -borderPadding ||
                screenPos.y > Screen.height + borderPadding || screenPos.y < -borderPadding)
            {
                SceneStateManager.GetInstance().TransitionTo(destination);
            }
        }
    }
Example #8
0
    // Save the SceneStateManager
    public void saveData()
    {
        if (!Directory.Exists(dataDirectory))
        {
            Directory.CreateDirectory(dataDirectory);
        }

        FileStream file = File.Open(dataDirectory + saveName + ".dat", FileMode.OpenOrCreate);

        BinaryFormatter formatter = new BinaryFormatter();

        try
        {
            formatter.Serialize(file, SceneStateManager.GetInstance());
        }
        catch (SerializationException se)
        {
            Debug.LogException(se);
        }
        finally
        {
            file.Close();
        }
    }
Example #9
0
 public void debugSSM()
 {
     Debug.Log(SceneStateManager.GetInstance().ToString());
 }
Example #10
0
    /* Instance Vars */

    /* Instance Methods */
    public void ContinueGame()
    {
        //TODO continue button functionality
        SceneStateManager.GetInstance().JumpTo("test1");         //DEBUG temp continue func
    }
Example #11
0
 public override int execute(params string[] args)
 {
     Console.print(SceneStateManager.GetInstance().ToString());
     return(Console.EXEC_SUCCESS);
 }
Example #12
0
 private void StartCampaign()
 {
     SceneStateManager.GetInstance().JumpTo("test1");         //DEBUG change debug starting room
 }