bool HasAnotherMemberFront() { Vector3 rayStartPos = transform.position; rayStartPos.y += transform.localScale.y / 2f; int memberLayer = 1 << LayerMask.NameToLayer("Member"); float rayLength = _navigator.radius * 2f; return(TransformUtils.IsHitDirection(transform, transform.forward, 0f, rayLength, 1, memberLayer)); }
void CheckJumped() { if (_jumped) { _onPhysicsTime += Time.deltaTime; if (_onPhysicsTime > 0.25f && TransformUtils.IsHitDirection(transform, Vector3.down, _navigator.radius, _navigator.height, 4, _downRayLayer)) { _processing = false; _jumped = false; ClosePhysics(); StartNav(); } } }
private void FixedUpdate() { _onGround = TransformUtils.IsHitDirection(transform, Vector3.down, _baseRadius * _controller.radius * 2f, _controller.height, 4, _downRayLayer); if (!_fallFlag && !_onGround) //just started falling { _fallFlag = true; _fallStartPos = GetPosAroundBase(head.forward.normalized * -1f, _baseRadius); Debug.LogWarning($"Gang fall start on pos {_fallStartPos}"); } else if (_fallFlag && _onGround) // gang falled and landed { _fallFlag = false; FelledGround(_fallStartPos, _activeMembers); Debug.LogWarning($"Gang fall end on pos {head.position}"); } }