// Use this for initialization
 void Start()
 {
     if (!world.GetComponent <GameWorldScript>().DisableDrain)
     {
         world.GetComponent <GameWorldScript>().SetEnergy(0);
     }
     SM    = GameObject.Find("SoundManager");
     saver = GameObject.Find("SaveDataLoader");
     CPS   = saver.GetComponent <XMLScript>().LoadPlayersStats();
     score = CPS.score;
     lastLevelCompleted = CPS.level;
     if (CPS.life > 0)
     {
         life = CPS.life;
     }
     StartCheckPoint = GameObject.Find("CheckPoint" + (CPS.level));
     print(CPS.level.ToString());
     startPosition      = StartCheckPoint.transform.position;
     transform.position = startPosition;
     GetComponent <Rigidbody2D>().freezeRotation = true;
     anim     = GetComponent <Animator>();
     playerBC = GetComponent <BoxCollider2D>();
     standBox = new Vector2(playerBC.size.x, playerBC.size.y);
     slideBox = new Vector2(playerBC.size.y, playerBC.size.x);
 }
    void SavePlayersCurrentLevelAndScore(int num)
    {
        CurrentPlayerStats CPL = new CurrentPlayerStats();

        CPL.level = num;
        CPL.score = CalcScore();
        saver.SendMessage("SavePlayersStats", CPL);
    }
 public void SavePlayersStats(CurrentPlayerStats CPS)
 {
     //save players level and score
     PlayerPrefs.SetInt("PlayersLevel", CPS.level);
     PlayerPrefs.SetFloat("PlayersScore", CPS.score);
     PlayerPrefs.SetInt("PlayersLife", CPS.life);
     PlayerPrefs.Save();
 }
    public CurrentPlayerStats LoadPlayersStats()
    {
        //load players level and score
        CurrentPlayerStats CPS = new CurrentPlayerStats();

        CPS.level = PlayerPrefs.GetInt("PlayersLevel");
        CPS.score = PlayerPrefs.GetFloat("PlayersScore");
        CPS.life  = PlayerPrefs.GetInt("PlayersLife");
        return(CPS);
    }
    void Start()
    {
        if (PlayerPrefs.HasKey("DefaultGame"))
        {
            DefaultedGame = PlayerPrefs.GetFloat("DefaultGame");
        }
        if (Application.loadedLevelName == "MainMenu" && DefaultedGame == 0)
        {
            StartGame();
        }
        CurrentPlayerStats CPS = new CurrentPlayerStats();

        CPS = LoadPlayersStats();
        if (LevelText != null)
        {
            LevelText.text = "Level " + (CPS.level + 1);
        }
        ApplySettings();
    }
Example #6
0
 public ValueTask FruitEaten() => CurrentPlayerStats.FruitEaten();
Example #7
0
 public void Update(CanvasTimingInformation timing)
 {
     CurrentPlayerStats.Update(timing);
 }
 public void Initialize()
 {
     player1Stats = new CurrentPlayerStats("Player 1");
     generalstats.ReadStats();
 }
 void Start()
 {
     sm = GameObject.Find("SoundManager");
     if (PlayerPrefs.HasKey("DefaultGame")) DefaultedGame = PlayerPrefs.GetFloat("DefaultGame");
     if (Application.loadedLevelName == "MainMenu" && DefaultedGame == 0) StartGame();
     CurrentPlayerStats CPS = new CurrentPlayerStats();
     CPS = LoadPlayersStats();
     if (LevelText != null) LevelText.text = "Level " + (CPS.ArcadeLevel);
     ApplySettings();
     if (Application.loadedLevelName == "HighScores") OrganizeLevelFiles();
 }
 public void SavePlayersStats(CurrentPlayerStats CPS)
 {
     //save players level and score
     if (sm.GetComponent<SoundManager>().GameState == 1)
         PlayerPrefs.SetInt("PlayersLevel", CPS.level);
     else
         CPS.ArcadeLevel = 1;
     PlayerPrefs.SetFloat("PlayersScore", CPS.score);
     PlayerPrefs.SetInt("PlayersLife", CPS.life);
     PlayerPrefs.Save();
 }
 public CurrentPlayerStats LoadPlayersStats()
 {
     //load players level and score
     CurrentPlayerStats CPS = new CurrentPlayerStats();
     CPS.level = PlayerPrefs.GetInt("PlayersLevel");
     CPS.score = PlayerPrefs.GetFloat("PlayersScore");
     CPS.life = PlayerPrefs.GetInt("PlayersLife");
     return CPS;
 }
Example #12
0
 public void Initialize()
 {
     player1Stats = new CurrentPlayerStats("Player 1");
     player2Stats = new CurrentPlayerStats("Player 2");
 }
 void Start()
 {
     if (PlayerPrefs.HasKey("DefaultGame")) DefaultedGame = PlayerPrefs.GetFloat("DefaultGame");
     if (Application.loadedLevelName == "MainMenu" && DefaultedGame == 0) StartGame();
     CurrentPlayerStats CPS = new CurrentPlayerStats();
     CPS = LoadPlayersStats();
     if (LevelText != null) LevelText.text = "Level "+(CPS.level+1);
     ApplySettings();
 }
 public void SavePlayersStats(CurrentPlayerStats CPS)
 {
     //save players level and score
     PlayerPrefs.SetInt("PlayersLevel", CPS.level);
     PlayerPrefs.SetFloat("PlayersScore", CPS.score);
     PlayerPrefs.SetInt("PlayersLife", CPS.life);
     PlayerPrefs.Save();
 }
 void SavePlayersCurrentLevelAndScore(int num)
 {
     CurrentPlayerStats CPL = new CurrentPlayerStats();
     CPL.level = num;
     CPL.score = CalcScore();
     saver.SendMessage("SavePlayersStats", CPL);
 }
 // Use this for initialization
 void Start()
 {
     if (!world.GetComponent<GameWorldScript>().DisableDrain) world.GetComponent<GameWorldScript>().SetEnergy(0);
     SM = GameObject.Find("SoundManager");
     saver = GameObject.Find("SaveDataLoader");
     CPS = saver.GetComponent<XMLScript>().LoadPlayersStats();
     score = CPS.score;
     lastLevelCompleted = CPS.level;
     if(CPS.life > 0) life = CPS.life;
     StartCheckPoint = GameObject.Find("CheckPoint" + (CPS.level));
     print(CPS.level.ToString());
     startPosition = StartCheckPoint.transform.position;
     transform.position = startPosition;
     GetComponent<Rigidbody2D>().freezeRotation = true;
     anim = GetComponent<Animator>();
     playerBC = GetComponent<BoxCollider2D>();
     standBox = new Vector2(playerBC.size.x, playerBC.size.y);
     slideBox = new Vector2(playerBC.size.y, playerBC.size.x);
 }