Exemple #1
0
    private void Update()
    {
        activeCount = 0;

        foreach (ParticleSystem particle in particleSystems)
        {
            if (particle.IsAlive())
            {
                activeCount++;
            }
        }

        if (activeCount < 1)
        {
            switch (particleEndAction)
            {
            case ParticleEndAction.Destroy:
                particleInstancer.DestroyParticleSystem(gameObject);
                break;

            case ParticleEndAction.Deactivate:
                particleInstancer.UnpoolParticleSystem(particleTag, gameObject);
                break;

            default:
                break;
            }
        }
    }
Exemple #2
0
    void BasicAttackUpdate()
    {
        if (isDashing || isThrowing || isCastingArea || isCastingLightRain || moveStates == MoveStates.Dead)
        {
            return;
        }

        SetRotation(RotationTypes.BasicAttack);

        if (Vector3.Distance(playerTransform.position, enemyTargetTransform.position) < attackRange)
        {
            if (!attack)
            {
                thorAnimator.SetTrigger("hit");
                particleInstancer.InstanciateParticleSystem("Thor_basicAttack", GameObject.FindWithTag("hammerParent").transform, new Vector3(-0.023f, -0.024f, -0.624f), Quaternion.identity);
            }
            attack = true;
        }
        else
        {
            if (attack)
            {
                particleInstancer.DestroyParticleSystem("Thor_basicAttack(Clone)");
            }
            attack = false;
        }

        if (attack)
        {
            canMove = false;
            playerAgent.isStopped = true;

            if (thorAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 <= 0.1f)
            {
                if (alreadyAttacked)
                {
                    alreadyAttacked = false;
                }
            }

            if (!alreadyAttacked)
            {
                if (thorAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 >= 0.35f && thorAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime % 1 <= 0.45f)
                {
                    DealBasicAttackDamage();
                }
            }
        }
        else
        {
            canMove = true;
            playerAgent.isStopped = false;

            thorAnimator.ResetTrigger("hit");
            alreadyAttacked = false;
        }
    }
    void DisableJumpF()
    {
        enemyAgent.speed        = enemySpeed;
        enemyAgent.acceleration = enemyAcceleration;
        isJumping = false;

        enemyAnimator.ResetTrigger("jumpAttack");

        particleInstancer.DestroyParticleSystem("Fenrir_mist(Clone)");

        if (basicAttackTrigger.TargetIsInRange(targetTransform.name))
        {
            SetAttack();
        }
        else
        {
            SetChase();
        }

        StartCoroutine(FenrirJumpCD());
    }