Beispiel #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.name == "Player")
     {
         Destroy(gameObject);
         thePlayer.HealPlayer(healAmount);
     }
 }
Beispiel #2
0
 private void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Player")
     {
         playerHealth.HealPlayer(healAmount);
         Destroy(gameObject);
     }
 }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E) && Time.time > nextHeal)
     {
         isOnCD   = true;
         timeCD   = healRate;
         nextHeal = Time.time + healRate;
         playerHealth.HealPlayer(healValor);
     }
     if (isOnCD)
     {
         CDUpdate();
     }
 }
Beispiel #4
0
    public void MangerRepas(Repas repas)
    {
        PlayerHealthManager phm = FindObjectOfType <PlayerHealthManager>();

        phm.HealPlayer(repas.heal);
        FindObjectOfType <WeaponOnPlayer>().damageBuff           += repas.damageBuff - 1;
        FindObjectOfType <PlayerControllerIsometric>().speedBuff += repas.speedBuff - 1;
        GetComponent <ItemManager>().loot += repas.lootBuff;
        phm.currentShield += repas.shieldBuff;
        phm.StartCoroutine(phm.AutoHeal(repas.lifeBuff, repas.timeOfBuff));

        if (repas.timeOfBuff != 0) // Infini
        {
            StartCoroutine(WaitTimeOfBuff(repas));
        }
    }
Beispiel #5
0
    /// <summary>
    /// Use a consumable. Can be overwritten.
    /// </summary>
    /// <param name="item">Item to consume</param>
    /// <param name="slot">Slot to remove item</param>
    /// <param name="deleteItem">If one time use or not</param>
    void UseConsumable(Item item, int slot, bool deleteItem) //TODO: Quantity remove
    {
        switch (item.itemID)
        {
        //Meat
        case 0:
            playerHealthManager.HealPlayer(10);
            Debug.Log("Consume");
            break;

        default:
            break;
        }

        if (deleteItem)
        {
            hotBar[slot] = new Item();
        }
    }
Beispiel #6
0
    void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.name == "turble_0" && Input.GetKeyUp(KeyCode.Space))
        {
            if (!dManager.dialogIsActive)
            {
                dManager.dialogLines = dialogueLines;
                dManager.currentLine = 0;
                dManager.ShowDialogue();
            }

            if (positiveInteraction)
            {
                healthManager.HealPlayer(impact);
            }
            else
            {
                healthManager.HurtPlayer(impact);
            }
        }
    }
Beispiel #7
0
    void OnTriggerEnter2D(Collider2D entered)
    {
        if (entered.tag == "WeaponItem")
        {
            entered.tag = "Weapon";
            Destroy(entered.transform.GetComponent <Collider2D>());
            entered.transform.SetParent(transform.Find("Hand"));
            entered.transform.localPosition = new Vector2(0f, 0f);
            entered.transform.localRotation = new Quaternion(0, entered.transform.localRotation.y, 0, 0);
        }
        if (entered.tag == "Item")
        {
            if (entered.GetComponent <WeaponStats>() != null)
            {
                var weaponBonusStat = entered.GetComponent <WeaponStats>();

                weaponStats.accuracy   += weaponBonusStat.accuracy;
                weaponStats.damage     += weaponBonusStat.damage;
                weaponStats.fireRate   += weaponBonusStat.fireRate;
                weaponStats.speed      += weaponBonusStat.speed;
                weaponStats.ammunition += weaponStats.ammunition;
            }
            if (entered.GetComponent <PlayerStats>() != null)
            {
                var playerBonusStat = entered.GetComponent <PlayerStats>();

                playerStats.moveSpeed += playerBonusStat.moveSpeed;
                if (isServer)
                {
                    playerHealth.MaxHealthUp(playerBonusStat.playerFullHealth);
                    playerHealth.HealPlayer(playerBonusStat.playerCurrentHealth);
                }
            }
            NetworkServer.Destroy(entered.gameObject);
        }
    }