private static void Beat(Character attacker, Character defender, AttackType attackType) { if (attackType.Equals(AttackType.Strike)) { Strike(attacker, defender); } else { Spell(attacker, defender); } }
public Attack getAttack(AttackType aType) { foreach (Attack attack in attacksInCharacter) { if (aType.Equals(attack.getAttackType())) { return(attack); } } return(null); }
public Attack getAttack(AttackType aType) { foreach(Attack attack in attacksInCharacter){ if(aType.Equals (attack.getAttackType())){ return attack; } } return null; }
public void Damage(AttackType type, Damage dmg, Actor atkActor, Vector3 dmgPosition) { m_canJump = true; if (m_isInvulnerable && !type.Equals(AttackType.GRAB)) { return; } switch (type) { case AttackType.HIT: if (dmg.ID.Equals(DamageRecieverId)) { // Return because this damage is already being applied to this actor return; } m_dmgRecieverId = dmg.ID; m_healthPercentage = dmg.Hurt + HealthPercentage > MAX_HEALTH_PERC ? MAX_HEALTH_PERC : HealthPercentage + dmg.Hurt; if (dmgPosition != Vector3.zero) { EffectManager.Hit(dmgPosition, dmg.Hurt); if (!type.Equals(AttackType.STRIKE_GRAPPLE)) { SoundManager.Instance.Slap(AudioSource); } } if (!m_isHyperArmor && !State.Equals(ActorState.GRABBING) && !State.Equals(ActorState.GRABBED) && !State.Equals(ActorState.BEING_THROWN)) { m_animator.Rebind(); m_canJump = true; //Determine force Vector2 force = new Vector2(dmg.Force.x * (HealthPercentage / HEALTH_PERC_FORCE_MOD), dmg.Force.y * (HealthPercentage / HEALTH_PERC_FORCE_MOD)); if (atkActor != null && atkActor.transform.position.x >= transform.position.x) { force = new Vector2(force.x * -1, force.y); Rigidbody.rotation = FACE_RIGHT; } else { Rigidbody.rotation = FACE_LEFT; } if (force.y > 0) { m_groundCheckDistance = GROUND_CHECK_MIN; } // Stop Actor so crazy forces don't get applied Rigidbody.velocity = Vector3.zero; // Used mainly so throws on undamaged enemies actually seems like you can throw enemies force.y = force.y < dmg.Force.y ? dmg.Force.y : force.y; // Headge maximum velocities force.y = force.y > MAX_FORCE_VEL ? MAX_FORCE_VEL : force.y; force.x = force.x > MAX_FORCE_VEL ? MAX_FORCE_VEL : force.x; Rigidbody.AddForce(new Vector3(force.x, force.y), ForceMode.Impulse); AddToStunTime(dmg.Hurt); if (HealthPercentage >= DMG_STUN_THRESHOLD && !State.Equals(ActorState.STUNNED)) { // This is for a smooth tranistion to stunned animation UpdateState(ActorState.DAMAGED); UpdateState(ActorState.STUNNED); } else { UpdateState(ActorState.DAMAGED); } if (dmg.Hurt > WrestlerAttackManager.PUNCH_DMG && !Grounded) { StartCoroutine(GameManager.DynamicDamageView(force, atkActor, this)); } OnDamage(); } break; case AttackType.GRAB: if (atkActor != null && !State.Equals(ActorState.GRABBED) && !State.Equals(ActorState.GRABBING) && !State.Equals(ActorState.BEING_THROWN)) { m_animator.Rebind(); OnGrabbed(atkActor); } break; } }