Esempio n. 1
0
    private void Update()
    {
        if (!jump)
        {
            jump = Input.GetButtonDown("Jump");
        }

        if (Input.GetButtonDown("Fire1"))
        {
            weapon.Attack();
        }
    }
Esempio n. 2
0
    private void Update()
    {
        if (weaponBehaviour.isAttack)
        {
            return;
        }

        Vector3 mousePosition = Input.mousePosition;

        mousePosition.z = target.position.z - Camera.main.transform.position.z;
        Vector3 rot = Camera.main.ScreenToWorldPoint(mousePosition) - target.position;

        weaponBehaviour.SetRotate(rot.normalized);

        if (Input.GetMouseButtonDown(0))
        {
            weaponBehaviour.Attack();
        }
    }
 public void Attack()
 {
     //attack with weapon if mobile has any weapon
     if (CanAttack() && RightHandle != null && RightHandle.transform.childCount > 0)
     {
         //Debug.Log(Time.time - lastAttackTime);
         lastAttackTime = Time.time;
         if (WeaponBehaviour == null)
         {
             WeaponBehaviour = RightHandle.GetComponentInChildren <BaseWeaponBehaviour>();
             if (WeaponBehaviour != null)
             {
                 WeaponBehaviour.Attack(GetSwingRate());
             }
         }
         else
         {
             WeaponBehaviour.Attack(GetSwingRate());
         }
     }
 }
Esempio n. 4
0
 public void Attack()
 {
     weapon.Attack();
 }