// initializes strafing movement private void StartStrafing() { strafeDurationSet = Random.Range(strafeDurationMin, strafeDurationMax); float rand = Random.Range(0f, 1f); if (rand > 0.5f) { sidewaysStrafeDir = StrafeSidewaysDirection.Left; } else { sidewaysStrafeDir = StrafeSidewaysDirection.Right; } }
// change from strafing left or right private void SwitchStrafeDirection() { sidewaysStrafeDir = (sidewaysStrafeDir == StrafeSidewaysDirection.Left) ? StrafeSidewaysDirection.Right : StrafeSidewaysDirection.Left; strafeDurationSet = Random.Range(strafeDurationMin, strafeDurationMax); }