コード例 #1
0
 virtual public void BeginAttack(Damage damageToDeal, Fighter attacker)
 {
     weaponUser        = attacker;
     attackCast.OnHit += OnWeaponHit;
     damageOut         = damageToDeal;
     attackCast.Begin();
 }
コード例 #2
0
 public void Fire(float velocity, float secondsToDeath, Vector3 direction, Damage damage, float damageScalar, Team shooterTeam)
 {
     team              = shooterTeam;
     damageOut         = damage;
     attackCast.OnHit += OnProjectileHit;
     attackCast.Begin();
     keepAlive    = false;
     startingTime = Time.time;
     lifeTime     = secondsToDeath;
     projectileBody.AddForce(direction * velocity);
     damageScale = damageScalar;
 }
コード例 #3
0
ファイル: Fighter.cs プロジェクト: nasa03/gladiators
 void SetAttackActive(bool isActive)
 {
     if (attackCaster != null)
     {
         if (isActive)
         {
             attackCaster.Begin(currentAttack);
         }
         else
         {
             attackCaster.End();
         }
     }
 }
コード例 #4
0
ファイル: AILegacy.cs プロジェクト: nasa03/ness
	/// <summary>
	/// Starts the attack, activating the cast if needed, playing the animation, and starting
	/// timer for the attack.
	/// </summary>
	/// <param name="attackToStart">Attack to start.</param>
	void StartAttack (AttackData attackToStart)
	{
		// TODO This is bad practice. When we refactor this, let's properly enapsulate
		// the current attack in one of these classes.
		enemy.currentAttack = attackToStart;
		attackAnimation.Play (attackToStart.swingAnimation.name);
		if (!attackToStart.IsRanged ()) {
			attackCaster.OnHit += OnAttackHit;
			attackCaster.Begin ();
			trailRenderer.enabled = true;
		}
		attackTime.StartTimer (attackToStart.swingAnimation.length);
		isAttacking = true;
	}
コード例 #5
0
 /// <summary>
 /// Begin the sweep for damageable objects on the current attack
 /// </summary>
 public void StartAttackCast()
 {
     // TODO Consolidate this and the StartAttack for each enemy AI.
     // Ignore events that occur while blending out of Attack.
     if (usesAnimation)
     {
         bool isTransitioningToNonAttackState = animator.IsInTransition(0) &&
                                                !animator.GetNextAnimatorStateInfo(0).IsName("Base Layer.Attack");
         if (isTransitioningToNonAttackState)
         {
             return;
         }
     }
     attackCaster.OnHit += OnAttackHit;
     attackCaster.Begin();
 }