public override void Awake()
    {
        base.Awake();
        animator            = this.GetComponent <Animator>();
        this.fCurrentHealth = this.fStartHealth;
        movement            = this.GetComponent <CMovement>();
        shooter             = this.GetComponent <CShooter>();
        this.flashTime      = 0.25f;

        if (ES3.KeyExists("CurrentHealth", "Player.es3"))
        {
            fCurrentHealth = ES3.Load <float>("CurrentHealth", "Player.es3");
            fMaxHealth     = ES3.Load <float>("MaxHealth", "Player.es3");
            shield         = ES3.Load <int>("Shield", "Player.es3");
        }

        else
        {
            ES3.Save <int>("Shield", shield, "Player.es3");
            ES3.Save <float>("CurrentHealth", fCurrentHealth, "Player.es3");
            ES3.Save <float>("MaxHealth", fMaxHealth, "Player.es3");
        }

        heartUI = GameObject.Find("Heart_UI").GetComponent <CHeartUI>();
        heartUI.SetHeart((int)fCurrentHealth, (int)fMaxHealth, shield);
        onDeath += EndGame;
    }
Ejemplo n.º 2
0
 void Awake()
 {
     playerInput   = this.GetComponent <CInput>();
     rigidbody     = this.GetComponent <Rigidbody2D>();
     myCollider    = this.GetComponent <CapsuleCollider2D>();
     shooter       = this.GetComponent <CShooter>();
     interactItems = new List <IInteractItem>();
     interactList  = new Dictionary <IInteractItem, bool>();
 }