コード例 #1
0
 private void HandleDamage(IDamageDealer damageDealer)
 {
     currentHits += damageDealer.GetDamage();
     if (currentHits >= hitsToDestroy)
     {
         Destroy(this.gameObject);
         return;
     }
     spriteRenderer.sprite = destructionSprites[currentHits - 1];
 }
コード例 #2
0
ファイル: L3Boss.cs プロジェクト: Gamieon/PaperCowboys
 /// <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
ファイル: L3Boss.cs プロジェクト: Gamieon/PaperCowboys
 /// <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
ファイル: L2Boss.cs プロジェクト: Gamieon/PaperCowboys
 /// <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
ファイル: L2Boss.cs プロジェクト: Gamieon/PaperCowboys
 /// <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
ファイル: Barrel.cs プロジェクト: Gamieon/PaperCowboys
 /// <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
ファイル: PlayerOnFoot.cs プロジェクト: Gamieon/PaperCowboys
	/// <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
		}
	}