// Update is called once per frame void Update() { if (slidePlayer && fsmBoss.GetCurrentState() == FSMBoss.State.BACK_TO_CENTER) { if (theBoss.transform.position.x >= thePlayer.transform.position.x) { slideLeft = true; } else { slideLeft = false; } Vector3 pos = thePlayer.transform.position; if (slideLeft) { pos = new Vector3(pos.x - slideSpeed * Time.deltaTime, pos.y, pos.z); } else { pos = new Vector3(pos.x + slideSpeed * Time.deltaTime, pos.y, pos.z); } thePlayer.transform.position = pos; } }
void OnTriggerEnter(Collider collider) { string colliderLayer = LayerMask.LayerToName(collider.gameObject.layer); if (colliderLayer == "ground" || colliderLayer == "wall" || colliderLayer == "destroyableEagle") //Tornado doesnt break vertical walls { disipate = true; } else if (colliderLayer == "destroyable" /*|| colliderLayer == "destroyableEagle"*/) { collider.gameObject.SendMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver); } else if (collider.gameObject.CompareTag("Viking")) { if (!disipate) { FSMEnemy.State state = collider.gameObject.GetComponent <FSMEnemy>().currentState; if (state != FSMEnemy.State.DEAD && state != FSMEnemy.State.STUNNED) { PrepareRotation(collider.gameObject); } } } else if (collider.gameObject.CompareTag("Dark Elf")) { if (!disipate) { FSMDarkElf.State state = collider.gameObject.GetComponent <FSMDarkElf>().currentState; if (state != FSMDarkElf.State.DEAD && state != FSMDarkElf.State.STUNNED) { PrepareRotation(collider.gameObject); } } } else if (collider.gameObject.name != "FireAura" && collider.gameObject.CompareTag("Boss")) { if (!triggerTaken && !disipate) { triggerTaken = true; FSMBoss.State state = fsmBoss.GetCurrentState(); if (state == FSMBoss.State.CHASE && fsmBoss.prepareCast == false && bossStats.hitPoints > 0 || state == FSMBoss.State.PRE_MELEE_ATTACK || state == FSMBoss.State.MELEE_ATTACK || state == FSMBoss.State.POST_MELEE_ATTACK || state == FSMBoss.State.POST_BALL_ATTACK) { PrepareRotation(collider.gameObject); } } } }