Exemple #1
0
 void HeavyMeleeBsela()
 {
     if (Input.GetKeyDown(heavyMelee))
     {
         this.GetComponent <AudioSource>().volume = 1f;
         this.GetComponent <AudioSource>().PlayOneShot(bselaCarrotsFromTheGroundClip);
         myAnimator.SetBool("heavyMelee", true);
     }
     if (Input.GetKeyUp(heavyMelee))
     {
         info.AddEnergy(-heavyMeleeCost);
         carrotCollider.enabled = true;
         myAnimator.SetBool("heavyMelee", false);
     }
 }
Exemple #2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Drop"))
     {
         CollectOnClick drop = collision.gameObject.GetComponent <CollectOnClick>();
         player_info.AddEnergy(drop.loot_value);
         Destroy(collision.gameObject);
     }
 }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        if (!beginCarrotAttack)
        {
            attackTimeCounter += Time.deltaTime;

            if (attackTimeCounter >= attackWaitTime)
            {
                attackTimeCounter  = 0;
                myCollider.enabled = false;
            }
        }
        else
        {
            attackTimeCounter = 0;
        }

        if (beginCarrotAttack)
        {
            carrotTimeCounter += Time.deltaTime;
        }

        if (carrotTimeCounter >= carrotWaitTime)
        {
            if (myController.isBlocking)
            {
                myInfo.AddHealth(-10);
                myInfo.AddEnergy(-15);
            }
            else
            {
                myInfo.AddHealth(-15);
            }

            myCollider.enabled = false;
            myBody.velocity   += new Vector2(10, 20);
            //  myBody.AddForce(new Vector2(50, 25) * 1.0f, ForceMode2D.Impulse);
            carrotTimeCounter = 0;
            beginCarrotAttack = false;
        }
    }
Exemple #4
0
 void OnMouseEnter()
 {
     player_info.AddEnergy(loot_value);
     Destroy(gameObject);
 }