void Start() { animator = GetComponent <Animator>(); rb2D = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); player1 = GetComponent <UnitStateMono>(); boxCollider2D = GetComponent <BoxCollider2D>(); if (File.Exists(@"C:\Users\marsh\Documents\BackGround Project\Assets\MyTutorialGame\References" + "/savedGames.gd")) { player1Serial = new UnitStateSerial (GameState.Current.Player1Serial.xPos, GameState.Current.Player1Serial.yPos, GameState.Current.Player1Serial.facing, GameState.Current.Player1Serial.active); } else { player1Serial = new UnitStateSerial (0, 0, 0, true); } player1.Memento = player1Serial; player1 = player1.Revert(player1); }
// start void Start() { // component references animator = GetComponent <Animator>(); rb2D = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); playerStateMono = GetComponent <UnitStateMono>(); boxCollider2D = GetComponent <BoxCollider2D>(); // sets player position from boardScript.player, // sets player facing and active state to 0(up) and true playerStateSerial = new UnitStateSerial (GameManager.boardScript.player.transform, 0, true); // use playerstatemono's memento function to revert from playerStateMono.Memento = playerStateSerial; playerStateMono = playerStateMono.Revert(playerStateMono); }
public GameState(UnitStateSerial player1Serial) { Player1Serial = Player1Controller.playerStateSerial; string location = Location; string dateTime = DateTime; }