//Particle instancing overload public void SetDamage(float damage, bool playSFX, Quaternion particleAngle) { if (life > 0) { switch (enemyType) { case EnemyType.Skull: if (damage > 0) { particleInstancer.InstanciateParticleSystem("Enemy_Blood", transform.position + new Vector3(0, 1, 0), particleAngle); } break; case EnemyType.Fenrir: if (damage > 0) { particleInstancer.InstanciateParticleSystem("Enemy_Blood", transform.position + new Vector3(0, 2, -0.5f), particleAngle); } break; default: break; } } SetDamage(damage, playSFX); }
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 FronzenUpdate() { enemyAgent.isStopped = true; if (Vector3.Distance(transform.position, targetTransform.position) < chaseRange) { isInChaseRange = true; if (enemyType == EnemyStats.EnemyType.Skull) { SetRotation(); } } if (isInChaseRange) { if (enemyType == EnemyStats.EnemyType.Skull) { if (appearDelayTime >= 0) { appearDelayTime -= Time.deltaTime; if (!hasAppeared) { enemyAnimator.SetTrigger("appear"); particleInstancer.InstanciateParticleSystem("Spawn_v2", transform.position + new Vector3(0, 0.1f, 0), Quaternion.identity); enemyAudioPlayer.PlaySFX(2, 0.4f, Random.Range(0.96f, 1.04f)); hasAppeared = true; } return; } } if (unfreezeTime > 0) { unfreezeTime -= Time.deltaTime; return; } SetChase(); StartCoroutine(FenrirJumpCD()); } }