Example #1
0
    private void Start()
    {
        counter        = GameObject.FindGameObjectWithTag("PotionCounter").GetComponent <PotionCounter>();
        counter2       = GameObject.FindGameObjectWithTag("BombCounter").GetComponent <BombCounter>();
        damage         = 5;
        jumps          = 0;
        invincibleWait = new WaitForSeconds(0.5f);

        attack = GetComponent <PlayerAttack>();

        for (int i = 0; i < collectables.Length; i++)
        {
            collectables[i] = 0;
        }

        if (PlayerPrefs.HasKey("PlayerData"))
        {
            enemiesKilled    = PlayerPrefs.GetFloat("EnemiesKilled");
            health           = PlayerPrefs.GetFloat("Health");
            speed            = PlayerPrefs.GetFloat("Speed");
            defense          = PlayerPrefs.GetFloat("Defense");
            damage           = PlayerPrefs.GetFloat("Damage");
            maxHealth        = PlayerPrefs.GetFloat("Max Health");
            attack.swingRate = PlayerPrefs.GetFloat("Swing Rate");
            jumpVelocity     = PlayerPrefs.GetFloat("Jump Velocity");
            potions          = PlayerPrefs.GetInt("Potions");
            bombs            = PlayerPrefs.GetInt("Bombs");
        }
        counter.potionCount = potions;
        counter2.bombCount  = bombs;
        if (PlayerPrefs.HasKey("Level"))
        {
            int level = PlayerPrefs.GetInt("Level");

            bool skipAnim = false;

            if (PlayerPrefs.HasKey("SkipAnimation"))
            {
                int skipVal = PlayerPrefs.GetInt("SkipAnimation");
                skipAnim = skipVal == 1;
            }

            if (level != 0 && !skipAnim)
            {
                Disable();
                invincible = true;

                t.localScale = Vector3.zero;
                StartCoroutine(LoadIn());
            }
        }
    }
Example #2
0
 private void Start()
 {
     counter   = GameObject.FindGameObjectWithTag("BombCounter").GetComponent <BombCounter>();
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
 }