Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     currentHP      = HPLevels[1];
     currentAttack  = attackLevels[1];
     currentDefence = defenceLevels[1];
     playerHP       = FindObjectOfType <PlayerHPManager>();
 }
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemplo n.º 3
0
 void Start()
 {
     target      = PlayerManager.instance.player.transform;
     agent       = GetComponent <NavMeshAgent>();
     targetStats = player.GetComponent <PlayerStats>();
     hpManager   = player.GetComponent <PlayerHPManager>();
     _anim       = transform.Find("Body").GetComponent <Animator>();
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     currentHP      = HPLevels[1];
     currentAttack  = attackLevels[1];
     currentDefence = defenceLevels[1];
     playerHP       = FindObjectOfType <PlayerHPManager>();
     healthShards   = 0;
     healthPacks    = 0;
     magicMeter     = 0;
     magicActive    = false;
 }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (playerHPM == null)
        {
            playerHPM = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHPManager>();
        }
        healthBar.maxValue = playerHPM.playerMaxHP;
        healthBar.value    = playerHPM.playerCurrentHP;
        healthText.text    = string.Format("HP: {0}/{1}", playerHPM.playerCurrentHP, playerHPM.playerMaxHP);

        lvlText.text = string.Format("Lvl {0}", playerS.currentLevel);
    }
    // Start is called before the first frame update
    public void InicialSetup()
    {
        PlayerObj     = GameObject.FindGameObjectWithTag("Player");
        MainObjective = GameObject.FindGameObjectWithTag("Objective");

        NavAgent              = gameObject.GetComponent <NavMeshAgent>();
        Anim                  = gameObject.GetComponent <Animator>();
        PlayerManagerScript   = PlayerObj.GetComponent <PlayerHPManager>();
        ObjctiveManagerScript = MainObjective.GetComponent <MainObjectiveManager>();

        NavAgent.speed = MoveSpeed;
        Objective      = MainObjective;
    }
Exemplo n.º 7
0
    IEnumerator useMagic()
    {
        GameObject       thePlayer = GameObject.Find("Player");
        PlayerController playerControllerScript = thePlayer.GetComponent <PlayerController>();
        PlayerHPManager  playerScript           = thePlayer.GetComponent <PlayerHPManager>();

        if (pStats.magicMeter >= 75 && !pStats.magicActive)
        {
            pStats.magicActive = true;
            pStats.magicMeter -= 50;
            yield return(new WaitForSeconds(20));

            pStats.magicActive = false;
        }
    }
Exemplo n.º 8
0
    public void LevelUp()
    {
        currentLevel++;

        currentHP      = HPLevels[currentLevel];
        currentAttack  = attackLevels[currentLevel];
        currentDefence = defenceLevels[currentLevel];

        if (playerHP == null)
        {
            playerHP = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHPManager>();
        }
        playerHP.playerMaxHP      = currentHP;
        playerHP.playerCurrentHP += currentHP - HPLevels[currentLevel - 1];  //This will heal up player by the difference between old and new health lvl, on level up
    }
Exemplo n.º 9
0
    IEnumerator useHealthPackTimer()
    {
        GameObject       thePlayer = GameObject.Find("Player");
        PlayerController playerControllerScript = thePlayer.GetComponent <PlayerController>();
        PlayerHPManager  playerScript           = thePlayer.GetComponent <PlayerHPManager>();

        if (pStats.healthPacks > 0 && playerScript.playerCurrentHP != playerScript.playerMaxHP && !pStats.usingHealthPack)
        {
            playerControllerScript.canMove = false;
            pStats.usingHealthPack         = true;
            yield return(new WaitForSeconds(2));

            pStats.healthPacks           -= 1;
            playerScript.playerCurrentHP += playerScript.playerMaxHP / 3;
            playerScript.playerCurrentHP  = Mathf.Min(playerScript.playerCurrentHP, playerScript.playerMaxHP);
            pStats.usingHealthPack        = false;
        }
        playerControllerScript.canMove = true;
    }