private void Update() { timebetweenattacks -= Time.deltaTime; timeBetweenSword -= Time.deltaTime; if (Input.GetMouseButton(0)) { switch (attacktodo) { case AttackToDo.melee: { if (timebetweenattacks < 0) { MeleeAttack(); timebetweenattacks = starttimebetweenattacks; PlayerAttacking?.Invoke(); } break; } case AttackToDo.ranged: if (timeBetweenSword < 0) { RangedAttack(); PlayerAttacking?.Invoke(); timeBetweenSword = startTimebetweenSword; } break; case AttackToDo.nothing: break; } } if (Input.GetMouseButtonDown(1)) { //Debug.Log("Switching weapon"); SwitchingWeapon(); } }
public void Attack() { playerAttacking.Invoke(player.playerId); }