protected virtual bool CoverMove() { float distanceToEdge; Vector3 edgePos; if (ActionMoveCover.Direction == AgentActionCoverMove.E_Direction.Left) { edgePos = Owner.BlackBoard.Cover.LeftEdge; } else { edgePos = Owner.BlackBoard.Cover.RightEdge; } edgePos.y = Owner.Position.y; // check only 2d distanceToEdge = (edgePos - Owner.Position).magnitude; float moveDistance = Owner.BlackBoard.Speed * Time.deltaTime; //Debug.Log(distanceToEdge); if (distanceToEdge < moveDistance) { //Debug.Log(Time.timeSinceLevelLoad + " distance to edge " + distanceToEdge); Owner.Transform.position = edgePos; return(false); } return(Owner.RestrictedCoverMove(ActionMoveCover.Direction, moveDistance)); }