Ejemplo n.º 1
0
 /*
  * void Jump(){
  *  if( ( Input.GetButtonDown("Jump") || Input.GetAxisRaw("Vertical")>0 )
  *  &&!anim.GetBool("isJumping")){
  *      isJumping=true;
  *      anim.SetTrigger("doJumping");
  *      anim.SetBool("isJumping",true);
  *  }
  *  if(!isJumping){
  *      return;
  *  }
  *
  *  if(isInAir){
  *      return;
  *  }
  *
  *  rb.velocity = Vector2.zero;
  *
  *  Vector2 jumpVelocity = new Vector2(0,jumpPower);
  *  rb.AddForce(jumpVelocity,ForceMode2D.Impulse);
  *
  *  isJumping=false;
  * }
  */
 void UseTheFirstItem()
 {
     if (Input.GetMouseButtonDown(1))
     {
         //Debug.Log("GetButtonDown: time = " + Time.time);
         var item = inventory.GetItemByIndex(0);
         if (item != null)
         {
             //Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             inventory.RemoveItem(item, 1);
             //item.ExecuteAllItemBuff(this.gameObject,mousePosition);
             item.ExecuteAllItemBuff(this.gameObject);
         }
     }
 }