Пример #1
0
 private void HandleDamage(IDamageDealer damageDealer)
 {
     currentHits += damageDealer.GetDamage();
     if (currentHits >= hitsToDestroy)
     {
         Destroy(this.gameObject);
         return;
     }
     spriteRenderer.sprite = destructionSprites[currentHits - 1];
 }
Пример #2
0
 /// <summary>
 /// Called by the player observing their projectile making contact with this character to inflict
 /// damage to this character. This must never be called from an RPC.
 /// </summary>
 /// <param name='damager'>
 /// An interface to the object dealing the damage.
 /// </param>	
 void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
 {
     if (!IsDying)
     {
         float damage = damageDealer.GetDamage();
         // Tell all players that this character is taking damage. Since we only support players damaging bosses, GetOwningPlayer should never be null.
         myNetworkView.RPC("RPCBoss3TakeDamage", uLink.RPCMode.All, damage, damageDealer.GetOwningPlayer() );
     }
     else
     {
         // Ignore if the character is already dying
     }
 }
Пример #3
0
 /// <summary>
 /// Called by the player observing their projectile making contact with this character to inflict
 /// damage to this character. This must never be called from an RPC.
 /// </summary>
 /// <param name='damager'>
 /// An interface to the object dealing the damage.
 /// </param>	
 void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
 {
     if (!IsDying)
     {
         float damage = damageDealer.GetDamage();
         // Tell the master client that this character is taking damage
         photonView.RPC("RPCBoss3TakeDamage", PhotonTargets.All, damage, (damageDealer.IsOwnedByPlayer() ? damageDealer.GetOwningPlayer() : null) );
     }
     else
     {
         // Ignore if the character is already dying
     }
 }
Пример #4
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (other.tag == m_ExcludedTag)
                return;

            //Check if the object that we hit was a damagedealer
            IDamageDealer damageDealer = other.gameObject.GetComponent<IDamageDealer>();

            if (damageDealer != null)
            {
                int damage = damageDealer.GetDamage();
                Damage(damage);
                damageDealer.HadContact(gameObject);
            }
        }
Пример #5
0
 /// <summary>
 /// Called by the player observing their projectile making contact with this character to inflict
 /// damage to this character. This must never be called from an RPC.
 /// </summary>
 /// <param name='damager'>
 /// An interface to the object dealing the damage.
 /// </param>	
 void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
 {
     if (!IsDying)
     {
         float damage = damageDealer.GetDamage();
         // Tell the master client that this character is taking damage
         photonView.RPC("RPCBoss2TakeDamage", PhotonTargets.All, damage, (damageDealer.IsOwnedByPlayer() ? damageDealer.GetOwningPlayer() : null) );
         // If we clearly doomed the character, begin its VISIBLE death sequence here. The master
         // client will eventually destroy it from the game.
         if (hitPoints - damage < MinHitpointsBeforeFrag)
         {
             BeginDying(); // This will flag the character as dying
         }
     }
     else
     {
         // Ignore if the character is already dying
     }
 }
Пример #6
0
 /// <summary>
 /// Called by the player observing their projectile making contact with this character to inflict
 /// damage to this character. This must never be called from an RPC.
 /// </summary>
 /// <param name='damager'>
 /// An interface to the object dealing the damage.
 /// </param>	
 void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
 {
     if (!IsDying)
     {
         float damage = damageDealer.GetDamage();
         // Tell all players that this character is taking damage. Since we only support players damaging bosses, GetOwningPlayer should never be null.
         myNetworkView.RPC("RPCBoss2TakeDamage", uLink.RPCMode.All, damage, damageDealer.GetOwningPlayer() );
         // If we clearly doomed the character, begin its VISIBLE death sequence here. The master
         // client will eventually destroy it from the game.
         if (hitPoints - damage < MinHitpointsBeforeFrag)
         {
             BeginDying(); // This will flag the character as dying
         }
     }
     else
     {
         // Ignore if the character is already dying
     }
 }
Пример #7
0
 public void Damage(IDamageDealer damageDealer)
 {
     Hurt(damageDealer.GetDamage());
 }
Пример #8
0
 /// <summary>
 /// Called by the player observing their projectile making contact with this character to inflict
 /// damage to this character. This must never be called from an RPC.
 /// </summary>
 /// <param name='damager'>
 /// An interface to the object dealing the damage.
 /// </param>	
 void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
 {
     if (!IsDying)
     {
         float damage = damageDealer.GetDamage();
         // Tell everybody that this barrel is taking damage
         uLink.NetworkView.Get(this).RPC("RPCBarrelTakeDamage", uLink.RPCMode.All, damage, damageDealer.GetOwningPlayer() );
     }
     else
     {
         // Ignore if the character is already dying
     }
 }
Пример #9
0
	/// <summary>
	/// Called by the player observing their projectile making contact with this character to inflict
	/// damage to this character. This must never be called from an RPC.
	/// </summary>
	/// <param name='damager'>
	/// An interface to the object dealing the damage.
	/// </param>	
	void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
	{
		if (!IsDying)
		{
#if PLAYER_TAKES_DAMAGE
			float damage = damageDealer.GetDamage();
			// Tell everybody that this barrel is taking damage
			photonView.RPC("RPCPlayerOnFootTakeDamage", PhotonTargets.All, damage);
#endif
		}
		else
		{
			// Ignore if the character is already dying
		}
	}
Пример #10
0
	/// <summary>
	/// Called by the player observing their projectile making contact with this character to inflict
	/// damage to this character. This must never be called from an RPC.
	/// </summary>
	/// <param name='damager'>
	/// An interface to the object dealing the damage.
	/// </param>	
	void IDamageTaker.TakeDamage(IDamageDealer damageDealer)
	{
		if (!IsDying)
		{
#if PLAYER_TAKES_DAMAGE
			float damage = damageDealer.GetDamage();
			// Tell everybody that this barrel is taking damage
			networkView.RPC("RPCPlayerCharacterHorseTakeDamage", RPCMode.All, damage);
#endif
		}
		else
		{
			// Ignore if the character is already dying
		}
	}