Exemplo n.º 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag.Equals("Enemy"))
        {
            if (owner == ProjectileOwner.Enemy)
            {
                return;
            }

            EnemyHealth enemyHealth = other.GetComponent <EnemyHealth>();
            enemyHealth.TakeDamage(damage, damageType);

            EnemyAI enemy = other.GetComponent <EnemyAI>();
            if (enemy != null)
            {
                enemy.ApplyMovementEffect(new MovementEffect(slowDuration, slowMultiplier));
            }
            Destroy(gameObject);
        }
        else if (other.tag.Equals("Player"))
        {
            if (owner == ProjectileOwner.Player)
            {
                return;
            }

            PlayerHealth playerHealth = other.GetComponent <PlayerHealth>();
            playerHealth.TakeDamage(damage);

            PlayerMovement playerMovement = other.GetComponent <PlayerMovement>();
            playerMovement.ApplyMovementEffect(new MovementEffect(slowDuration, slowMultiplier));
            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag.Equals("Enemy") && timer >= activationDelay)
        {
            EnemyAI enemy = other.GetComponent <EnemyAI>();
            if (enemy != null && !taggedEnemies.Contains(enemy))
            {
                StaffBlizzardIce ice = other.GetComponentInChildren <StaffBlizzardIce>();

                if (ice != null)
                {
                    ice.EnableIce(8.0f);
                    enemy.ApplyMovementEffect(new MovementEffect(8.0f, 0.0f));
                }

                taggedEnemies.Add(enemy);
            }
        }
    }
Exemplo n.º 3
0
    void Update()
    {
        pulseTimer += Time.deltaTime;

        if (pulseTimer > movementEffectDuration)
        {
            pulseTimer = 0.0f;
            GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");

            for (int i = 0; i < enemies.Length; i++)
            {
                if (Vector3.Distance(transform.position, enemies[i].transform.position) < auraRange)
                {
                    EnemyAI enemy = enemies[i].GetComponent <EnemyAI>();
                    if (enemy != null)
                    {
                        enemy.ApplyMovementEffect(new MovementEffect(movementEffectDuration, movemenetEffectMultiplier));
                    }
                }
            }
        }
    }