private void Update() { if (!jump) { jump = Input.GetButtonDown("Jump"); } if (Input.GetButtonDown("Fire1")) { weapon.Attack(); } }
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()); } } }
public void Attack() { weapon.Attack(); }