// Update is called once per frame void Update() { //Animation Section Start if (anim != null) { anim.SetFloat("EnemyMoving", GetEnemyMovementCtrl.agent.speed); } //Animation Section End //MARK: TEMPORARY FIX FOR ENEMIES REMAINING STAGGERED if (CurrentStatus == EnemyBehaviorStatus.Staggered) { StaggeredCheckCount += Time.deltaTime; if (StaggeredCheckCount >= StaggeredCheckTime) { ChangeStatus(EnemyBehaviorStatus.Waiting); anim.Play("Idle"); } } else { StaggeredCheckCount = 0; } UpdateEnemyBehaviorStatus(); if (ArcAngle != 360 && CurrentStatus != EnemyBehaviorStatus.ArcRunner) { director.ReturnAngle(ArcAngle); ArcAngle = 360; GetEnemyMovementCtrl.SetTarget(playerT); } //we will need to make some new moves if it is a boss, currently preventing boss from jumping //obviosuly if your currently doing something, or shouldnt be able to do something, you can't attack if (!director.IsBusy(CurrentStatus) && myAction == EnemyActions.None) { if (checkplayer(attackrange)) { //check if the player is in front of you var heading = playerT.position - transform.position; float dot = Vector3.Dot(heading, transform.forward); if (dot > .5) // must be 30 degrees in front { //If two many attacks recently, continue doing what they were doing if (director.TryNormalAttack()) { KnightActions.StartCoroutine("PerformNormalAttack"); } else { KeepDistance(); } } } //This will need to go to KnightEnemyActions and check which attack it should attempt, rather than using range else if (checkplayer(Special1RangeTEMP) && Vector3.Distance(transform.position, playerT.position) > Special1RangeTEMP - 1 && etc.MyEnemyType != EnemyType.Boss) // we will need an alternative way to check if doing special 1 is right that is specific to the enemy { if (director.TrySpecial1Attack()) { KnightActions.StartCoroutine("PerformSpecial1Attack"); } } else if (CurrentStatus == EnemyBehaviorStatus.SurroundPlayer && Vector3.Distance(transform.position, playerT.position) > ProjectileLaunchDistance) { if (CanThrow) { if (director.TryProjectileAttack()) { CanThrow = false; StartCoroutine(KnightActions.ThrowProjectile()); } } } } if (CurrentStatus == EnemyBehaviorStatus.Busy && CanThrowAOE) //BossComment { StartCoroutine(KnightActions.ThrowFireAOE()); } if (StartupCheck && CurrentStatus != EnemyBehaviorStatus.Sleeping) { startupTime += Time.deltaTime; if (startupTime > director.ReturnProjectileAttackDelay) { CanThrow = true; StartupCheck = false; } } }