void UpdateState() { Vector3 prevLaneOffset = currentLane.GetOffset(); switch (currentState) { case DogState.CHASE: currentLane = player.currentLane; break; case DogState.LUNGE: // Take care of warning period if (delayTimer < LUNGE_DELAY) { delayTimer += Time.deltaTime; warningSprite.SetActive(true); } else { warningSprite.SetActive(false); lungeTimer++; // If dog has finished lunging, make it go back to chasing if (lungeTimer > MAX_LUNGE_TIMER) { lungeTimer = 0; delayTimer = 0.0f; currentState = DogState.CHASE; } } break; } transform.position = new Vector3 ( transform.position.x, currentLane.GetY() + 0.1f, transform.position.z ) - prevLaneOffset + currentLane.GetOffset(); }
void ShiftLaneDown() { Debug.Log("Lane Down"); Vector3 prevLaneOffset = currentLane.GetOffset(); switch (currentLane) { case Lane.CLOSE: break; case Lane.MID: currentLane = Lane.CLOSE; break; case Lane.FAR: currentLane = Lane.MID; break; } transform.position = new Vector3 ( transform.position.x, currentLane.GetY() + 0.1f, transform.position.z ) - prevLaneOffset + currentLane.GetOffset(); }