Exemplo n.º 1
0
    /// <summary>
    /// Method for processing melee attacks
    /// </summary>
    /// <param name="attacker">Game object that is attacking</param>
    /// <param name="target">Game object being attacked</param>
    /// <param name="knockbackDirX">X Knockback direction</param>
    /// <param name="knockbackDirY">Y Knockback direction</param>
    public void ProcessMelee(IBaseStats attacker, IDamagable target, int knockbackDirX, int knockbackDirY)
    {
        int amount = CalculateAttackAmountMelee(attacker);

        ProcessAttack(target, amount);
        ProcessKnockbackOnHit(attacker, knockbackDirX, knockbackDirY);
        ProcessKnockbackOnDamage(target, -knockbackDirX, -knockbackDirY);
    }
Exemplo n.º 2
0
 public void getHitBy(IBaseStats attacker, int knockbackDirX, int knockbackDirY)
 {
     if (!stunned)
     {
         StartCoroutine(StunTimer());
         attackProcessor.ProcessMelee(attacker, GetComponent <IDamagable>(), knockbackDirX, knockbackDirY);
     }
 }
 public HealthControllerBehaviour(float healthRegenerationOnLevelUp, Animator anim, ActionScheduler actionScheduler, Collider[] colliders, MonoBehaviour[] components, IBaseStats stat)
 {
     _healthRegenerationOnLevelUp = healthRegenerationOnLevelUp;
     _anim            = anim;
     _actionScheduler = actionScheduler;
     _colliders       = colliders;
     _components      = components;
     _stat            = stat;
 }
Exemplo n.º 4
0
 public void init()
 {
     anim            = Substitute.For <Animator>();
     actionScheduler = Substitute.For <ActionScheduler>();
     stat            = Substitute.For <IBaseStats>();
     stat.GetStat(Stat.Health).Returns(100);
     behaviour = new HealthControllerBehaviour(0f, anim, actionScheduler, null, null, stat);
     behaviour.init();
     //behaviour.healthPoints.value.Returns(100);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Helper method that knocks back the attacker
 /// </summary>
 /// <param name="attacker">Attacker object</param>
 /// <param name="knockbackDirX">X Knockback direction</param>
 /// <param name="knockbackDirY">Y Knockback direction</param>
 private void ProcessKnockbackOnHit(IBaseStats attacker, int knockbackDirX, int knockbackDirY)
 {
     attacker.KnockbackOnHit(attacker.HitKnockbackAmount, knockbackDirX, knockbackDirY);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Helper method that determines melee damage amount
 /// </summary>
 /// <param name="attacker">Attacking game object</param>
 /// <returns></returns>
 private int CalculateAttackAmountMelee(IBaseStats attacker)
 {
     return((int)(Random.Range(attacker.MinMeleeDamage, attacker.MaxMeleeDamage + 1) * attacker.MeleeAttackMod));
 }