void Awake() // PlayerPrefs are loaded in Awake, so the Start order doesn't matter { points = PlayerPrefs.GetInt("Points", 0); multiplier = PlayerPrefs.GetInt("Multiplier", 1); switch (PlayerPrefs.GetInt("FrictionLevel", 0)) { case 0: frictionLevel = FrictionState.Low; break; case 1: frictionLevel = FrictionState.Medium; break; case 2: frictionLevel = FrictionState.High; break; case 3: frictionLevel = FrictionState.ExtraHigh; break; } }
public override void Move(float move, bool crouch, bool jump) { if (move == 0 && grounded) { if (fState != FrictionState.infinite) { fState = FrictionState.infinite; phyMat.friction = infinity; GetComponent <Collider2D>().enabled = false; GetComponent <Collider2D>().enabled = true; } } else if (GetComponent <Rigidbody2D>().velocity.y == 0 && !grounded) { if (fState != FrictionState.air) { fState = FrictionState.air; phyMat.friction = airFriction; GetComponent <Collider2D>().enabled = false; GetComponent <Collider2D>().enabled = true; } } else { if (fState != FrictionState.ground) { fState = FrictionState.ground; phyMat.friction = groundFriction; GetComponent <Collider2D>().enabled = false; GetComponent <Collider2D>().enabled = true; } } base.Move(move, crouch, jump); }