Example #1
0
    private GameState NewGame()
    {
        PlayerStateSerial player1Serial = Player1Controller.player1Serial;
        PlayerStateSerial player2Serial = Player2Controller.player2Serial;
        PlayerStateSerial player3Serial = Player3Controller.player3Serial;
        PlayerStateSerial player4Serial = Player4Controller.player4Serial;
        PlayerStateSerial player5Serial = Player5Controller.player5Serial;
        PlayerStateSerial player6Serial = Player6Controller.player6Serial;
        PlayerStateSerial player7Serial = Player7Controller.player7Serial;

        GameState game = new GameState
        {
            Player1Serial = player1Serial,
            Player2Serial = player2Serial,
            Player3Serial = player3Serial,
            Player4Serial = player4Serial,
            Player5Serial = player5Serial,
            Player6Serial = player6Serial,
            Player7Serial = player7Serial
        };

        return(game);
    }
    void Start()

    {
        animator = GetComponent <Animator>();

        rb2D = GetComponent <Rigidbody2D>();

        spriteRenderer = GetComponent <SpriteRenderer>();

        player6 = GetComponent <PlayerStateMono>();

        boxCollider2D = GetComponent <BoxCollider2D>();

        if (GameManager.loadedGame == true)

        {
            player6Serial = new PlayerStateSerial

                                (GameState.Current.Player6Serial.xPos,

                                GameState.Current.Player6Serial.yPos,

                                GameState.Current.Player6Serial.facing,

                                GameState.Current.Player6Serial.active);
        }

        if (GameManager.loadedGame == false)

        {
            player6Serial = new PlayerStateSerial(0f, 0f, 0, true);
        }

        player6.Memento = player6Serial;

        player6 = player6.Revert(player6);
    }