// Delegates triggers #region public void StartAttack() { if (OnStartAttack != null) { OnStartAttack.Invoke(); } }
public void Attack() { if (!CanAttack()) { return; } _lastAttack = Time.time; OnStartAttack?.Invoke(); }
/// <summary> /// Activates the hit box. /// When activated, produces the effect of the given attack to any <see cref="TDS_Damageable"/> in <see cref="collider"/> zone whose layer is in <see cref="WhatHit"/>. /// </summary> /// <param name="_attack">Attack used to hit what is in the hit box.</param> public void Activate(TDS_Attack _attack) { if (!PhotonNetwork.isMasterClient) { return; } // If the given attack is null, send the information in the console // and return before activating the hit box. if (_attack == null) { Debug.LogWarning("The given attack to activate " + Owner.name + "'s hit box is null ! Activation is canceled."); return; } CurrentAttack = _attack; collider.enabled = true; IsActive = true; OnStartAttack?.Invoke(_attack); }
public void OnStartAnimation() { OnStartAttack?.Invoke(); }
public void StartAttack() { OnStartAttack?.Invoke(); isAttack = true; }
private void Update() { agent.destination = player.transform.position; if (Vector3.Distance(transform.position, player.transform.position) < attackDistance) { //if(debug) Debug.Log("Attacking"); bool wasAttacking = isAttacking; isAttacking = true; if (!wasAttacking) { OnStartAttack?.Invoke(); } } else { //if(debug) Debug.Log("Not attacking"); bool wasAttacking = isAttacking; isAttacking = false; if (wasAttacking) { OnStopAttack?.Invoke(); } } if (isAttacking) { moveState = SpeedState.Idle; agent.speed = 0f; } else { if (Stunned) { moveState = SpeedState.Walking; agent.speed = speed / 3f; } else { moveState = SpeedState.Running; agent.speed = speed; } switch (SettingsHandler.cache.dificulty) { case Difficulty.Easy: agent.speed *= .8f; break; default: break; case Difficulty.Hard: agent.speed *= 1.1f; break; case Difficulty.Extreme: agent.speed *= 1.2f; break; } } stunDuration -= Time.deltaTime; if (stunDuration < 0f) { stunDuration = 0f; } }