Esempio n. 1
0
 private void OnTriggerStay(Collider other)
 {
     if (IsAttacking)
     {
         PlayerCombatManager _playerCombatManager = other.gameObject.GetComponent <PlayerCombatManager>();
         if (_playerCombatManager != null && CurrentAttackMotion != null)
         {
             // calculate regular attack
             Vector3 _AttackVector = this.transform.forward.normalized * CurrentAttackMotion.Force;
             //Debug.Log("Attacked with " + _AttackVector);
             _playerCombatManager.ReceivePlayerAttack(_AttackVector, CurrentAttackMotion.KnockBackTime);
             StopAttack();
             if (AudioController != null)
             {
                 AudioController.TriggerPlaySFXOnAll((int)EnemySFX.SLAP);
             }
         }
     }
 }
Esempio n. 2
0
    /// <summary>
    /// Author: Feiyang Li
    /// integrating with combat system
    /// </summary>
    private void OnTriggerStay(Collider Other)
    {
        if (Other.gameObject.tag == "Player" && PhontonView.IsMine)
        {
            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }

            PlayerCombatManager _playerCombatManager = Other.gameObject.GetComponent <PlayerCombatManager>();
            if (_playerCombatManager != null)
            {
                Vector3 _AttackVector = (Other.transform.position - this.transform.position).normalized * Force;
                _playerCombatManager.ReceivePlayerAttack(Forward * Force + UpwardsAdjustmentVector, BulletAttackTimeSpan);
            }
        }
        else if (Other.gameObject.tag == "Obstacle")
        {
            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }
        }
    }