void FixedUpdate() { if (!aiLock) { if (!asteriodOverride) { if (TC == null) { FindTC(); } objID.velo = agent.velocity.magnitude; //Timers attackTimer += Time.unscaledDeltaTime; mineTimer += Time.unscaledDeltaTime; repairTimer += Time.unscaledDeltaTime; //Check Idle Condition idle = (agent.velocity.magnitude < 0.1f); if (idle) { idleTimer += Time.unscaledDeltaTime; } else { idleTimer = 0.0f; } //Stuck logic (path pending + no movement) stuck = (idle && (agent.pathPending || agent.pathStatus == NavMeshPathStatus.PathPartial)); //We are stupid stuck if (idle && idleTimer > maxstuckTime) { stuck = true; } if (stuck) { if (idleTimer > maxstuckTime) { idleTimer = 0.0f; target.Reset(); Stop(); } } //Update Laser Beam if (lr != null) { lr.SetPosition(0, laserEmitterPositions[currentLaserEmitter].transform.position); if (target.hasTargetObj()) { lr.SetPosition(1, target.tarObject.transform.position); } } //Check and fix things target.Sanity(); UpdateType(); if (TCRetOverride) { TCRetOverrideBehaviour(); } else { if (idle && !target.hasTarget()) { //If we have rocks and we don't have anywhere to go if (idle && currentInv > 0) { TCRetOverride = true; } else { IdleAttackLogic(); } } if (target.hasTarget()) { AttackLogic(); } } //Death if (objID.health <= 0) { Destroy(gameObject); } } //We are in asteriod mode else { Debug.Log("Ateriod Mode"); } } }