void Emerge(Steering steering) { float currentDepth = steering.mondelTransform.position.y; steering.SetColliderEnable(currentDepth); if (currentDepth >= 0f) { return; } float emergeMove = _emergeSpeed * Time.deltaTime; currentDepth += emergeMove; if (currentDepth > 0f) { currentDepth = 0f; } Vector3 pos = steering.mondelTransform.position; pos.y = currentDepth; steering.mondelTransform.position = pos; }
void Dive(Steering steering) { float currentDepth = steering.mondelTransform.position.y; steering.SetColliderEnable(currentDepth); if (currentDepth < _diveDepth) { return; } float diveMove = _diveSpeed * Time.deltaTime; currentDepth += diveMove; if (currentDepth < _diveDepth) { currentDepth = _diveDepth; } Vector3 pos = steering.mondelTransform.position; pos.y = currentDepth; steering.mondelTransform.position = pos; }