Beispiel #1
0
 void Start()
 {
     animator          = player.GetComponent <Animator>();
     playerStatsScript = player.GetComponent <PlayerUIUpdates>();
     movement          = new Vector3(1f, -0.7f, 0f);
     player            = GameObject.Find("Player").transform;
 }
Beispiel #2
0
    public void UseItem(Item item)
    {
        GameObject player = GameObject.Find("Player");

        if (item.Name == "HealthPotion")
        {
            PlayerUIUpdates playerUI = player.GetComponent <PlayerUIUpdates>();
            if (playerUI.currentHealth + 20 >= playerUI.maxHealth)
            {
                playerUI.currentHealth = playerUI.maxHealth;
            }
            else
            {
                playerUI.currentHealth += 20;
            }
            playerUI.OnRestoreHpFromPotion();
            ReduceNumberOfItems(item.Name);
        }
    }
Beispiel #3
0
 private void Start()
 {
     playerData    = GetComponent <PlayerUIUpdates>();
     skillCooldown = GetComponent <SkillCooldown>();
 }