コード例 #1
0
	public override void HandleOnTargetHit(ProjectileEntity source, EntityComponent target)
	{
		base.HandleOnTargetHit(source, target);
		
		target.Damage(Magnitude, MyEntityComponent);		
		target.BroadcastMessage("BeingAttacked", this.MyEntityComponent);
	}
コード例 #2
0
	void HandleOnTargetHit(ProjectileEntity source, EntityComponent target)
	{
		//If it was hit by a projectile then unsubscribe from its event.
		if (source != null)
		{
			source.OnProjectileHitTargetEvent -= HandleOnTargetHit;
		}
		
		if (audioInfo.audioClipNames.ContainsKey("attackHit"))
			SoundEffectManager.PlayClipAtLocation(audioInfo.audioClipNames["attackHit"], target.transform.position);
		
		if (target != null && target.Alive)
			target.Damage(attackDamage, myEntityComponent);		
		
		//Apply our attack effects.
		if (target != null && target.Alive)
		{
			foreach (EntityModifier modifier in attackModifiers.Values)
			{
				modifier.DeepClone().Attach(target);
			}
		}
		
		if (OnTargetHitEvent != null)
			OnTargetHitEvent(myEntityComponent, target);
	}