void Awake() { if (!GAME_CONTROLLER) { player1Score = 0; player2Score = 0; GAME_CONTROLLER = this; DontDestroyOnLoad(gameObject); } else if (GAME_CONTROLLER != this) { Destroy(gameObject); GAME_CONTROLLER.Start(); } }
int playerNum; //set based on name void Start() { rb = gameObject.GetComponent <Rigidbody2D>(); gcs = game_controller_script.GAME_CONTROLLER; anim_script = gameObject.GetComponent <player_anim_script>(); Debug.Assert(rb && gcs && anim_script); startPosit = transform.position; startSize = transform.localScale; canJump = true; doubleJump = true; hasWallJumped = false; if (gameObject.name == ("Player1")) { playerNum = 1; } else if (gameObject.name == "Player2") { playerNum = 2; } inSuddenDeath = false; }