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); } }
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); } } }
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)); } } } } }