예제 #1
0
    void Start()
    {
        healthBar = FindObjectOfType <HealthBar>();
        dashBar   = FindObjectOfType <DashBar>();

        myRigidBody = GetComponent <Rigidbody2D>();
        animator    = GetComponent <Animator>();

        crosshair      = FindObjectOfType <Crosshair>();
        spriteRenderer = GetComponent <SpriteRenderer>();

        levelManager = FindObjectOfType <LevelManager>();
        audioManager = FindObjectOfType <AudioManager>();
        //pauseMenu = FindObjectOfType<PauseMenu>();

        healthBar.SetMaxHealth(maxHealth);

        if (PlayerPrefs.HasKey("CurrentHealth") && PlayerPrefs.GetFloat("CurrentHealth") > 0)
        {
            currentHealth = PlayerPrefs.GetFloat("CurrentHealth");
            healthBar.SetHealth(currentHealth);
            Debug.Log("Active");
        }
        else
        {
            currentHealth = maxHealth;
        }


        currentCharge = maxCharge;
        dashBar.SetCharge(maxCharge);
        invincible = false;
    }
예제 #2
0
 private void Start()
 {
     dashBar = GetComponent <DashBar>();
 }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     aSource       = GetComponent <AudioSource>();
     p_rigidbody2D = GetComponent <Rigidbody2D>();
     db            = GetComponentInChildren <DashBar>();
 }