Exemplo n.º 1
0
    public override void OnHitTrigger(AttackObject attackObject, IHurtable entity)
    {
        base.OnHitTrigger(attackObject, entity);

        int random = Random.Range(0, 100);

        if (random <= procChance)
        {
            StatusEffect effect = ScriptableObject.Instantiate(statusEffect);
            effect.OnApplyEffect(entity.GetEntity());
        }
    }
Exemplo n.º 2
0
    public override void OnHitTrigger(AttackObject attackObject, IHurtable entity)
    {
        base.OnHitTrigger(attackObject, entity);

        if (entity.GetEntity().Body.mIsKinematic || entity.GetEntity().abilityFlags.GetFlag(AbilityFlag.Heavy))
        {
            return;
        }

        if (entity.GetEntity() is Enemy enemy)
        {
            enemy.mEnemyState = EnemyState.Jumping;
        }

        if (entity.GetEntity() is Player player)
        {
            player.movementState = MovementState.Knockback;
        }

        Vector2 knockbackVector;

        if (entity.GetEntity().Body.mPS.pushesBottom)
        {
            knockbackVector = Vector2.right * attackObject.direction.x + Vector2.up * 0.5f;
        }
        else
        {
            knockbackVector = attackObject.direction;
        }

        entity.GetEntity().Body.mSpeed = knockbackVector.normalized * 500;
    }