コード例 #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
	/// <summary>
	/// Called when we are targeting an Entity.
	/// </summary>
	/// <param name='target'>
	/// The Entity we are targeting.
	/// </param>
	protected virtual void OnTargeting(EntityComponent target)
	{
		if (OnTargetingEvent != null)
			OnTargetingEvent(this.myEntityComponent, target);	
		
		//Message the attacker to let them know we're targeting them.
		target.BroadcastMessage("BeingTargeted", myEntityComponent, SendMessageOptions.DontRequireReceiver);
	}
コード例 #3
0
	/// <summary>
	/// Called when we are targeting an Entity for attack.
	/// </summary>
	/// <param name='attacker'>
	/// The Entity performing the attack (Us!).
	/// </param>
	/// <param name='target'>
	/// The Entity we are targeting.
	/// </param>
	protected virtual void OnTargeting(EntityComponent attacker, EntityComponent target)
	{
		if (OnTargetingEvent != null)
			OnTargetingEvent(attacker, target);	
		
		State = AttackState.WaitingToAttack;
		
		//Stop our movement for the time being since we have units to attack.
		myEntityComponent.myMovement.StopMovement();
		
		//Message the attacker to let them know we're attacking.
		target.BroadcastMessage("BeingTargeted", myEntityComponent, SendMessageOptions.DontRequireReceiver);
	}