Esempio n. 1
0
 public virtual void AttackActor(Actor actorToAttack, float angle) {
     Vector3 particlePos = Vector3.zero;
     float weaponAttackPoints = Inventory.Weapon.Points;
     // attack was blocked:
     if (actorToAttack.IsBlocking && angle < actorToAttack.Inventory.Shield.AttackAngle) {
         particlePos = actorToAttack.equippedItemManager.ShieldHolder.Item.transform.position;
         Instantiate(ParticleManager.Instance.Sparks, particlePos, Quaternion.identity);
         actorToAttack.Block(gameObject, weaponAttackPoints);
         if (GetComponent<Player>())
             PlayerCamera.Instance.Shake(0.2f, 3, 4);
     } else {
         particlePos = new Vector3(actorToAttack.transform.position.x, equippedItemManager.WeaponHolder.Item.transform.position.y, actorToAttack.transform.position.z);
         Instantiate(ParticleManager.Instance.Blood, particlePos, Quaternion.identity);
         actorToAttack.TakeDamage(gameObject, weaponAttackPoints);
         if(GetComponent<Player>())
             PlayerCamera.Instance.Shake(0.2f, 3, 5);
         audioSource.PlayOneShot(AudioManager.Instance.HitActorClip);
         audioSource.pitch = UnityEngine.Random.Range(0.8f, 1.2f);
     }
 }