void End() { myCollider.isTrigger = false; tipCollider.enabled = true; if (playerAttributes != null && !damageDone) { if (playerAttributes.rigidBody.velocity.y < 0) { int _direction = playerAttributesDirection(); float _repulseForceY = spell.repulseVector.y * .3f; playerAttributes.TakeDamage(spell.firstDamage, HurtType.Repulsion, new Vector2(spell.repulseVector.x * _direction, _repulseForceY), spell.dazedTime, spell.elementDamage); playerAttributes.TakeEffect(spell.effect); damageDone = true; } } if (curLifeTime <= Time.time || health <= 0) { anim.SetTrigger(spellDestroyedParamID); tipCollider.enabled = false; myCollider.enabled = false; Instantiate(iceCloudPrefab, transform.position, transform.rotation); audioSource.PlayOneShot(spikeSmashClip); state = EnemySpellStates.Destroy; } }
protected void SwitchState(State newState) { if (lastSpell == "Knockback" && isCast) { FlipCharacter(false); } isPatrol = false; isChase = false; isAttack = false; isCast = false; isHurt = false; isStun = false; isDead = false; spellNumber = 0; spellState = EnemySpellStates.None; currentState = newState; if (newState == State.Dead) { isDead = true; Invoke("Dead", 3f); } }
void Prepare() { if (curPrepareTime <= Time.time) { anim.SetTrigger(spellCastParamID); audioSource.PlayOneShot(spikeCastClip); state = EnemySpellStates.Cast; } }
void Casted() { state = EnemySpellStates.End; anim.SetTrigger(spellEndParamID); }